TypologySienna Chen
ToolsLightweight

Unity WebGL

A full game engine running in the browser.

A full game engine exported to run in the browser. Real physics, animation and sound, behind a long loading bar and a download of 20 MB or more. Use it when the project already exists in Unity; for a web page it is almost always too much.

Breaks when
20MB+ downloadsmobile Safari runs out of memory
Also called
Unity export, WASM build, Unity Web

Prompts

Embed a Unity build properly
Embed a Unity WebGL build (Build/ folder) in a page: createUnityInstance with a custom progress bar, Brotli-compressed build with the correct Content-Encoding headers (write them for a Netlify _headers file), a static poster until loaded, and a plain message on mobile Safari when the build needs more than 200 MB of heap.
Talk to Unity from the page
Expose a C# method to the page via SendMessage("GameManager", "SetTheme", "dark") and send a message back from Unity to JS through a .jslib plugin. Keep the API to three calls and document each.
Cut the build size
A checklist to get a Unity WebGL build under 15 MB: managed code stripping level, texture compression (ASTC/DXT), strip unused shader variants, disable exceptions, IL2CPP settings. Order it by expected savings.

Related

Resources · 1