Getting Started with Unity WebGL

This document provides a guide for creating a sample app in Unity, building the app for WebGL, and deploying the app to VIVERSE.


Introduction

Anyone can publish their WebGL-compatible Unity project to VIVERSE in a few simple steps. In this guide, we'll walk through the process of creating an new Unity project, making sure it is compatible with WebGL, and publishing to VIVERSE using the VIVERSE CLI.

For this guide, we are using the VIVERSE CLI, but it is also possible to compress and upload your build file directly to the VIVERSE Studio.

While VIVERSE is a great place for multiplayer games with networked avatars — and we have a number of services that can help you implement these features — it is not required to implement networked avatars to publish to VIVERSE.

Prerequisites

  • Unity Hub and Unity installed on your device.

  • Node and npm installed on your device. Please use at least Node v22 - Only required if using the CLI, not VIVERSE Studio

A. Configure Your Unity Project

1

Create a Unity Project

2

Install the Unity Plugin

Navigate to Window > Package Manager > Unity Registry and search for "WebGL Publisher". Add the module to your project.

3

(Optional) Enable Decompression Fallback

Compression is supported on VIVERSE, however you can enable fallback if you are encountering errors or would like to have it included. Navigate to Edit > Project Settings > Player > Web Settings > Publishing Settings and check "Decompression Fallback".

B. Build and Publish to VIVERSE

1

Build your project

Navigate to Publish and select "WebGL Publish". In the pop-up, click "Build and Publish", selecting the desired folder for your build. When doing this for the first time, Unity will automatically publish to their web-servers for testing. For future builds, you can disable this behavior to just the builds without publishing.

2

Install the VIVERSE CLI

In a terminal session, run npm install -g @viverse/cli to install the CLI globally. Make sure you are using at least node v22.

3

Login to VIVERSE

In the terminal session, run viverse-cli auth login and enter your VIVERSE account email and password.

4

Create VIVERSE App

In the terminal session, run viverse-cli app create . Once complete, copy the app ID to be used when publishing.

5

Publish to VIVERSE

In the terminal session, run viverse-cli app publish {path/to/unity/webgl/build} --app-id {your app id from step 4} referencing folder containing the index.html of your Unity build.

6

Test & Configure World Settings

Navigate to the preview url created for the world. You can also access the world and its settings in studio.viverse.com/content.

7

Submit for Curation and Discovery

By default, worlds uploaded will only be accessible via preview urls. For placement and curation on our webpages, meaning your experience will be easier to share, please submit for review.

8

Iterate, Learn, Explore!

In addition to the sample scenes, the rough flow of api usage can be reviewed at https://github.com/ViveDeveloperRelations/ViverseUnitySDK/blob/master/Unity_Viverse_SDK_Developer_Guide.md And overview of the current version of the sdk with additional hints and tips at https://github.com/ViveDeveloperRelations/ViverseUnitySDK?tab=readme-ov-file#viverse-unity-sdk-for-webgl

Last updated

Was this helpful?