How Unity Uses WebAssembly
The Pipeline: From C# to Wasm
Unity games are written in C#, which normally runs on a managed runtime that does not exist in the browser. To get to the web, Unity uses a technology called IL2CPP, which converts the compiled C# into C++, and then that C++ is compiled to WebAssembly along with Unity's own C++ engine core. The result is a single body of wasm that contains both the engine and your game logic, loaded and run by a JavaScript layer Unity generates. Your C# never runs as C# in the browser, it runs as wasm that was C++ that was C#, which is a longer chain than most wasm builds but is invisible to you as the developer.
This pipeline is why Unity web builds behave the way they do. The engine runtime is large because it is a complete, general-purpose engine supporting 2D, 3D, physics, animation, and far more, and all of it compiles into the binary whether your game uses it or not unless you strip it. The JavaScript layer handles loading that binary, setting up the WebGL context, and feeding input and timing to the running module. From the player's perspective it is just a Unity game in a web page, but underneath it is one of the larger examples of wasm in practice.
Why the Builds Are Large
The defining characteristic of a Unity web build is its size, and it is worth being clear about why. The download is dominated not by your game's assets or logic but by the engine runtime compiled to wasm. Even a near-empty Unity project produces a multi-megabyte web build, because the engine itself is what is shipping. Your content adds to that, but the floor is set by Unity, which is the opposite of a hand-written wasm module where the binary contains only your code.
This is the central tradeoff of using Unity on the web rather than a leaner option. You get Unity's enormous feature set, its editor, and its cross-platform reach, and you pay for it with a download that a player must wait through before the game starts. For a game with depth and a willing audience, that loading screen is acceptable. For an instant-play casual game competing on immediacy, the weight can be a real disadvantage, which is part of why the broader engine comparison frames Unity as the heavy, feature-rich end of the spectrum.
A Unity web build's size is dominated by the engine runtime compiled to wasm, not your game. That is the price of Unity's feature set on the web, and it is why load-time optimization centers on shrinking and compressing that runtime.
Reducing Download Size
Unity provides levers to bring the size down, and using them is essential for a usable web build. Code stripping removes engine features your game does not use, shrinking the wasm binary, and it is one of the highest-impact settings for web. Compression matters enormously: serving the build with Brotli or gzip compression dramatically reduces transfer size, and configuring your host to serve the compressed files with the right headers is a step many developers miss, leaving them shipping uncompressed multi-megabyte binaries unnecessarily.
Beyond the engine, your own assets are the other half of the budget. Texture compression, audio compression, and loading assets on demand rather than all up front all reduce what the player waits for. Unity's addressable asset system lets you stream content after the initial load so the game starts sooner and pulls in the rest as needed. The general principle mirrors the web game performance guidance: get something playable on screen fast, then bring in the rest, rather than forcing the player to download everything before anything happens.
Performance in the Browser
Once loaded, a Unity web build runs the engine at wasm speed, which is close to native for the CPU-side work, but the performance picture is shaped by the browser environment. Rendering goes through WebGL, so it is bounded by what WebGL can express and by how efficiently the engine batches draw calls, the same constraints any web game faces. Memory is managed within the wasm module's linear memory, and a large game can press against browser memory limits, especially on mobile. And the single-threaded nature of the browser main thread means the engine cannot lean on threads as freely as it can natively.
In practice this means a Unity web build of a moderate 2D or 3D game performs well, while a heavy 3D game built for desktop may struggle in the browser, particularly on phones. The honest expectation is that the web build is a capable but constrained version of your game, not a pixel-for-pixel match of the desktop build's performance. Testing on real mobile devices is essential, because the gap between a desktop browser and a budget phone is wide, a point the mobile browser performance material covers in depth.
The First-Load Problem and How to Soften It
The single biggest user-experience hurdle for a Unity web game is the first load, when a new player must download the entire wasm runtime before anything appears, and how you handle that moment shapes whether they stay. A blank screen for ten seconds reads as a broken page, so a good Unity web build shows a branded loading bar immediately, giving the player a reason to wait and a sense of progress. Unity's loader supports a custom progress display, and using it rather than the default is one of the cheapest improvements you can make to perceived quality.
The deeper fix is to shrink what must load before the first frame. Beyond code stripping and compression, splitting your content so that only the first scene's assets are required up front, with the rest streamed afterward, can cut the initial wait dramatically. Caching also helps returning players, since the wasm binary can be cached by the browser so the second visit skips most of the download, which is why repeat plays of a Unity web game feel far snappier than the first. None of this removes the fundamental weight of the runtime, but together these measures turn a discouraging first load into a tolerable one, which for a web game is often the difference between a bounce and a session.
When Unity on the Web Makes Sense
Unity is the right choice for the web when you already use it, when you need its depth, or when the web is one of several platforms you are shipping to and you want a single project for all of them. The wasm export is mature and produces real, playable games. The decision comes down to whether your audience will accept the download size and whether your game's performance demands fit within the browser's constraints. For a rich game with players who expect a brief load, Unity on the web is a strong option.
If instead you are building specifically for instant-loading web play, or your game is simple enough that Unity's runtime would dwarf it, a lighter engine produces a far smaller build, as the Godot comparison and the broader engine overview lay out. The point is not that Unity's use of wasm is bad, it is excellent engineering, but that shipping an entire general-purpose engine as a binary is a specific tradeoff that suits some web games and not others. Match it to a game that justifies the weight.