![Preview](https://raw.githubusercontent.com/TengkuFathullah/UnityWebGL-LoadingTest/master/./preview.png)
![Tested up to Unity 2021.2](https://camo.githubusercontent.com/2113ad4d7d2197024f6f46005624d14ba6d968bcaf109a289c6120e278f78607/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7465737465642532307570253230746f253230756e6974792d323032312e322d677265656e2e7376673f6c6f676f3d756e6974792663616368655365636f6e64733d32353932303030)
Testing Unity's WebGL size and loading time for different versions and platforms
Unity Forum Thread.
- Physics
- GPU Instancing for materials
- Shadows
- Brotli Compression
- Togglable In-DOM Debug console (Example)
- Handy debug functions for times and memory consumption
- Responsive template layout for maximum mobile compatibility
Platform |
Chrome |
Firefox |
Edge |
Safari |
Internet Explorer |
Windows 10 |
✔️ |
✔️ |
✔️ |
➖ |
❌ |
Linux |
✔️ |
✔️ |
✔️ |
➖ |
➖ |
Mac |
✔️ |
✔️ |
✔️ |
✔️ |
➖ |
Android |
✔️ |
✔️ |
✔️ |
➖ |
➖ |
iOS |
✔️ |
⚠️ |
✔️ |
✔️ |
➖ |
✔️ : Supported | ⚠️ : Warning , see below | ❌ : not supported | ➖ : Not applicable
- For Unity 2019 builds throw an error on iOS Firefox (Does not happen for iOS Safari or iOS Chrome):
An error occured running the Unity content on this page. See you browser JavaScript console for more info. The error: Script error.
- Internet Explorer does not work for Unity WebGL builds, since it does not support wasm.
- Previous versions of Firefox on Android had some performance problems, they seemed to have fixed those. In general performance on mobile is by far not as good as a native app build, but should be enough for simple games.
- The server is configured to support wasm streaming and brotli compression, see .htaccess 2020 .htaccess 2019
- In order to get rid of the warning on android/iOS it is removed in a post process build step (File)
- You might need to reload the page on android/iOS when running the first time
- This is a very small example. When building larger WebGL applications, you might run into problems with memory or compile errors. I recommend to build from the start and very often, to catch the changes that create those problems.
- If you want to have the smallest file size possible, take a look at Project Tiny or web-specific libraries like Three.js.
- Removing the default skybox will save ~30kb.
- With 2021.2 Unity added the possibility to use different texture formats. The builds use the default DXT format, but since no texture is used this settings does not make any difference in this project.
- URP adds additional ~2.5 MB file size compared to the builtin render pipeline.
- In general the performance for URP seems to be better compared to builtin, but it has a larger build size.
- Built from branch minsize
- Built with Code Optimization:
Size
and IL2CPP Code Generation: Faster (smaller) builds
- Enable Exceptions:
None
- C++ Compiler Configuration:
Master