# Unity WebGL game hosting

Host your Unity WebGL build with HTTPS, playtest previews and your own domain. Follow the compression settings below, then deploy the built folder.

On the web at https://lobsite.com/hosting/unity

```sh
npx lobsite ./build/web
```

Build for Web into build/web with Decompression Fallback enabled, then run this from your project folder.

Publish a Unity Web build at a direct HTTPS link for players and testers. Upload the complete build folder, including its loader and data, and keep updating the same address. Unity's compression settings matter here: prepare the build for Lobsite before you upload it.

## How it works

1. **Build for Web.** Select Unity's Web platform (called WebGL in older versions). In Player Settings → Publishing Settings, enable **Decompression Fallback** if you use Gzip or Brotli compression. Build into `build/web`.
2. **Check the files and deploy.** Most Unity builds exceed the anonymous and Free file limits, so sign in with Standard if needed. Run `npx lobsite ./build/web`, or upload the complete build from the dashboard.
3. **Share and update the game.** Send players the live URL. Build again and deploy to the same site for updates, or use `npx lobsite --preview` for a separate playtest.

## Compression settings that work on Lobsite

Lobsite serves `.br` and `.gz` files as stored, without automatically adding a `Content-Encoding` header. A compressed Unity build expecting native browser decompression won't load correctly under those defaults.

Enable **Decompression Fallback** so Unity includes a JavaScript decompressor in its build. Alternatively, choose **Disabled** for compression, accepting the larger files and downloads. Check [Unity's deployment documentation](https://docs.unity.com/en-us/engine/6000.5/manual/platform-specific/webgl/building-distribution/deploying) for your editor version.

Keep `index.html`, the `Build/` directory, `TemplateData/` and any other generated folders together. Uploading only the `.wasm` or `.data` file doesn't produce a playable game.

## Check your largest Unity build file

Free and anonymous hosting allow 5 MB per file, 50 MB total and 100 files. Unity runtime and data files commonly exceed that first limit. Standard allows 100 MB per file, 2 GB total and 10,000 files. A build can fit within 2 GB overall and still fail because one data file is larger than 100 MB.

Inspect the finished build before uploading. If a file exceeds Standard's limit, reduce or restructure the build before deploying. The drop box above is limited to 25 MB per upload; use the CLI or signed-in dashboard for larger builds. See the [HTML5 game limits](https://lobsite.com/hosting/html5-games#limits) for the full comparison.

## Threads and private playtests

If you enable **Native C/C++ Multithreading**, configure cross-origin isolation. Put this in a `lobsite.toml` beside your project and deploy from there with `npx lobsite`:

```toml
dir = "build/web"

[[headers]]
for = "/*"
[headers.values]
Cross-Origin-Opener-Policy = "same-origin"
Cross-Origin-Embedder-Policy = "require-corp"
```

The drop box doesn't read `lobsite.toml`. Check that any third-party resources work under isolation. For confidential playtests, Standard offers a password covering every address of the site, including preview builds. Multiplayer and other backend services still run separately from Lobsite.

## Unity web sharing methods

| Method | What it provides | What to check |
|---|---|---|
| Lobsite live URL | A standalone playable release | Compression settings and plan limits |
| Lobsite preview URL | A separate test build | The same settings as live; preview doesn't replace live |
| Unity's local Build and Run | Testing on your development machine | Public hosting can have different headers and paths |

For the equivalent WebAssembly workflow in another engine, see [Godot hosting](https://lobsite.com/hosting/godot). The [HTML5 games guide](https://lobsite.com/hosting/html5-games) covers browser audio, embedding and caching.

## Frequently asked questions

### Why does my compressed Unity WebGL build fail to load?

Check whether the loader expects a `Content-Encoding` header. With Lobsite's default file serving, rebuild with Decompression Fallback enabled, or disable compression. Upload the complete new build together.

### Does every Unity WebGL build fit Standard?

No. Each file must be at most 100 MB and the complete site at most 2 GB, with no more than 10,000 files. Check the actual runtime, data and asset files.

### Can I publish Unity source files instead of a Web build?

No. Lobsite serves a finished Web build. It doesn't run Unity, compile C# or turn a desktop executable into a browser game.

### Does Unity multithreading work with a browser drop upload?

The default drop upload doesn't configure the isolation headers. Use the CLI and the header configuration above for builds requiring Native C/C++ Multithreading.

