FAQs
Note: Unity no longer provides support for WebGL 1 in builds created with the Auto Graphics API option.
How do I speed up my Unity WebGL build? ›
Enable Data caching so that Unity caches your contents asset data on the user's machine. Data caching can make the application run faster.
What is the WebGL limit in Unity? ›
That 2GB limit is imposed by the browser for each tab, and this includes memory for everything on that tab - cache, images, html, javascript, the unity app and so on.
What compression format is best for Unity WebGL? ›
Compression Format
Brotli compression offers the best compression ratios. Brotli compressed files are smaller than gzip, but take a longer time to compress, which increases your iteration times on release builds. Chrome and Firefox only natively support Brotli compression over HTTPS.
What will replace WebGL? ›
WebGPU is a JavaScript API provided by a web browser that enables webpage scripts to efficiently utilize a device's graphics processing unit (GPU). This is achieved with the underlying Vulkan, Metal, or Direct3D 12 system APIs. On relevant devices, WebGPU is intended to supersede the older WebGL standard.
Why does WebGL take so long to build? ›
WebGL builds use IL2CPP so you experience the kind of compilation a C++ developer would. It's normal, unfortunately. Fortunately, incremental builds will be faster. You also have the option to optimize for build time rather than runtime speed or size, which helps a bit.
How do I optimize WebGL performance? ›
Optimize “Lots of Objects” rendering
Render calls are performed for each object that needs to be drawn and are quite resource intensive. Therefore, it is always advisable to minimize the number of draw calls. This can be achieved through combining similar objects by merging their geometries.
Why is Unity so slow to load? ›
Opening a project,
Unity generally imports assets upfront, and that's why opening a project for the first time can take hours. You could run into a smaller version of the same problem when you work in a team, pull in the latest changes, and now have a handfull (hundreds?) of changes to assets.
What language does Unity WebGL use? ›
Technical overview. To run in WebGL, all code needs to be JavaScript. We use the emscripten compiler toolchain to cross-compile the Unity runtime code (written in C and C++) into asm. js JavaScript.
Does Unity WebGL work on Chrome? ›
WebGL is supported on Chrome. Opening local files is not supported in the webplayer due to security reasons; I expect the same for WebGL. Chrome does not support WebGL content from file:// urls - Use Build & Run, or upload it to a server - or use Firefox.
The best way to view the WebGL Player locally is to use Unity's Build And Run option (menu: File > Build And Run). Unity uses a local web server to host your build, and opens it from a localhost URL. Alternatively, you can use a custom local web server with properly configured response headers.
How do I reduce the size of a WebGL build in Unity? ›
Reducing the size of WebGL build
- Use atlases with power of 2 size (mostly 1024x1024)
- Use OGGs for the audio files.
- Use 90% crunch compression with high quality (anything less seems to reduce the quality and made the game ugly)
- Disable any exception and stacktrace.
- Strip the engine code.
How big is WebGL PlayerPrefs Unity? ›
- WebGL: Unity stores up to 1MB of PlayerPrefs data using the browser's IndexedDB API. For more information, see IndexedDB.
Does Unity use DX or OpenGL? ›
Unity has the ability to use DirectX 11 and OpenGL Core graphics APIs, with all the features that you expect from them: compute shaders, tessellation shaders, shader model 5.0 and so on.
How to enable WebGL Unity? ›
To create a build for WebGL, go to File > Build Settings from Unity's main menu. In the Platform list, select WebGL and then click Switch Platform. For Build Settings, refer to WebGL Build Settings.
Why is my Unity WebGL not loading? ›
If that doesn't help, try creating a new, empty project with your Unity version and try to upload that. If it works, close the editor and copy the contents of ProjectSettings over to the new project. Open the project, build and deploy again to see if it still works. If it fails, you know it's because of some setting.
Is Unity Web Player discontinued? ›
Unity web player has been discontinued for quite a long time now. There is absolutely no reason to waste your time developing for an obsolete platform.
Is WebGL widely supported? ›
Software. WebGL is widely supported by modern browsers.