RetiPie
Guides

Unity WebGL Export

Prepare a Unity WebGL build for RetiPie with working Player Settings, package it as a ZIP, and call the Unity SDK from C# for lifecycle and leaderboards.

RetiPie includes sdks/unity, a Unity WebGL package that exposes C# bindings for the window.retipie bridge.

Requirements

  • Unity 2022.3 or newer.
  • A WebGL build that runs in a browser without external service dependencies.
  • Assets included in the build output.
  • No bundled third-party ad network or tracking SDK.

Player Settings

Open Project Settings → Player → Web (WebGL) → Publishing Settings and check these before building:

SettingUse
Compression FormatBrotli, Gzip or Disabled — all three work.
Decompression FallbackOff.
Native C/C++ MultithreadingOff.

Compression Format. Unity's compressed builds normally need a web server that sends a Content-Encoding header. RetiPie doesn't need one: when your ZIP contains a Unity loader (*.loader.js), RetiPie decompresses the .data, .framework.js, .wasm and .symbols.json files in that build folder during upload. They keep their original names, so your index.html stays the same. Brotli gives the smallest ZIP to upload.

Decompression Fallback. With this option, Unity's loader runs its JavaScript from a blob: URL. The game runtime blocks blob: scripts, so the game stops while loading.

Multithreading. Threads need Web Workers and SharedArrayBuffer, and the game runtime blocks both. Keep the build single-threaded.

Build and upload

  1. Build the game for WebGL.
  2. Inspect the output folder and confirm index.html and the Build/ folder are present.
  3. ZIP the build output with index.html at the root, or inside one shared root folder.
  4. Upload the ZIP in RetiPie Slice.
  5. Use the device preview to test loading, input, audio, and runtime scale.

The ZIP limits apply to the decompressed files: each file can be up to 200 MB, and the whole game up to 500 MB.

SDK package

Install the Unity package from this repository path:

https://github.com/RetiPie/retipie.git?path=sdks/unity/Packages/com.retipie.sdk

The package is a no-op in the Unity Editor and on non-WebGL platforms. Runtime calls are active when the game runs as a WebGL export inside RetiPie.

Unity WebGL compiles to WebAssembly, which RetiPie supports. Keep the build self-contained — external resources and dynamically loaded scripts are blocked at runtime. See Game Requirements for the practical constraints.

On this page