> For the complete documentation index, see [llms.txt](https://docs.viverse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.viverse.com/standalone-app-publishing/unitywebgl-examples/getting-started-with-unity-webgl.md).

# 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](https://www.npmjs.com/package/@viverse/cli).

{% hint style="info" %}
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](/publishing-with-your-viverse-account.md#upload).
{% endhint %}

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](https://nodejs.org/en) and [npm](https://www.npmjs.com/package/@viverse/cli) installed on your device. Please use at least Node v22 - **Only required if using the CLI, not VIVERSE Studio**

{% hint style="warning" %}
In this tutorial, we will be using Unity v6.1, however any WebGL-compatible version of Unity should be supported.
{% endhint %}

## A. Configure Your Unity Project

{% stepper %}
{% step %}

### Create a Unity Project

<figure><img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FEAkfTUN9HeA8w2camlRk%2FScreenshot%202025-06-09%20at%207.19.18%E2%80%AFPM.png?alt=media&amp;token=82e6da48-12bb-482f-809d-fa65fcf5791e" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Install the Unity Plugin

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

<div align="center"><img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2Ft2wBcj2H24RbYyJxXu2Q%2FScreenshot%202025-06-09%20at%207.21.24%E2%80%AFPM.png?alt=media&amp;token=cf6d4c03-9b51-4d5d-ab2a-df519311ae33" alt=""></div>
{% endstep %}

{% step %}

### (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".

<figure><img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FHDZl05mogOp2sb3i0sni%2FScreenshot%202025-06-09%20at%207.40.56%E2%80%AFPM.png?alt=media&amp;token=8a33e533-655f-4f7f-9e3d-4e743693a69a" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

## B. Build and Publish to VIVERSE

{% stepper %}
{% step %}

### 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.

<figure><img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FkQbg3ddNBTkP9XPRQHRP%2FScreenshot%202025-06-09%20at%207.24.49%E2%80%AFPM.png?alt=media&amp;token=0ffbba1b-36b7-486d-9fc2-2a7607f56583" alt="" width="317"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### 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.

<figure><img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2F0T01r1hd2GUzNkwdSkuO%2FScreenshot%202025-06-09%20at%207.34.52%E2%80%AFPM.png?alt=media&amp;token=6a354efa-412a-415e-a42a-b76642c70cb2" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Login to VIVERSE

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

<figure><img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FBqITyQj41DIHYlvxHLuz%2FScreenshot%202025-06-09%20at%207.35.19%E2%80%AFPM.png?alt=media&amp;token=169d951a-33f3-4dcb-b064-de9471d3e5b3" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Create VIVERSE App

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

<figure><img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FWqDwet9jolk8lqRejbnY%2FImage%206-12-25%20at%201.06%E2%80%AFPM.jpg?alt=media&amp;token=6c4ebf86-bca1-4905-9edf-24aa13798670" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### 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.

<figure><img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FEWoVeucl1Xristw0d9Sz%2FScreenshot%202025-06-09%20at%207.35.45%E2%80%AFPM.png?alt=media&amp;token=cc4075a5-f7a9-4596-ae60-735e87ef82c2" alt="" width="375"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### 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](https://studio.viverse.com/content).

<figure><img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2FxUjK6xrFe5Yx4atvT6p3%2FScreenshot%202025-06-09%20at%207.45.53%E2%80%AFPM.png?alt=media&amp;token=c7dce2e7-d77c-45f5-a542-7ba05989b9be" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="https://1140075852-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4pMiThqqrBzfvP8uy5am%2Fuploads%2F5T1EHzOk5iug0PxYBaon%2FScreenshot%202025-06-09%20at%208.04.00%E2%80%AFPM.png?alt=media&amp;token=1dbc470f-3f9f-4c27-8d17-379aedf08ee9" alt="" width="316"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### 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](/publishing-with-your-viverse-account.md#upload).
{% endstep %}

{% step %}

### Iterate, Learn, Explore!

To add VIVERSE login, matchmaking, multiplayer, leaderboards, cloud save, or avatars, use the [VIVERSE Unity SDK](https://docs.viverse.com/developer-tools/unity/viverse-unity-sdk). Authentication is `AuthManager`, cloud save is `CloudSaveClient`, and leaderboards are `LeaderboardClient`. This page is packaging and upload. Do not create a `.jslib` for those features.
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.viverse.com/standalone-app-publishing/unitywebgl-examples/getting-started-with-unity-webgl.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
