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.

The RetiPie Unity package (com.retipie.sdk) calls the RetiPie runtime (window.retipie) from C#. It's published in RetiPie/retipie-sdk.

Requirements

  • Unity 2022.3 or newer. Version 1.0.0 was tested with Unity 6000.6.
  • 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. New Unity projects can include Unity Analytics and In-App Purchasing: remove them, and Unity Ads, in Window → Package Manager. RetiPie blocks their network calls.

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 Slice preview to test loading, input, audio, and scaling.

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

In Window → Package Manager → + → Install package from git URL, paste:

https://github.com/RetiPie/retipie-sdk.git?path=unity#v1.0.0

Git 2.14 or newer must be installed. Without Git, download RetiPie-SDK-1.0.0.unitypackage from Releases and import it with Assets → Import Package → Custom Package.

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