During my extensive interaction with unity WebGL, I found different things that are difficult to handle in unity WebGL or Unity WebGL has some serious limitations (But nevertheless I have managed to stream large 3D areas in unity WebGL with asset bundles). I have made this blog post in order to show you Unity3D WebGL issue sheet.
If you are interested to see what technologies or toolchain Unity WebGL using behind the Scene then check this post.
So, without a particular order here is the list of unity WebGL limitations with relevant references for your further research.
Note: In order to get the unity WebGL latest information or roadmap, I will highly recommend you check the unity official forum for the latest news.
Post Processing Auto Exposure and Ambient Occlusion
Auto exposure is not supported while the ambient occlusion Scalable Ambient Obsucrance only works in webgl. If you try to use it you will keep getting "KERNEL 'MULTISCALEVODOWNSAMPLE1' NOT FOUND...."
You can see the unity bug report is still active here.
The reason of this issue is the compute shader which is not supported yet. There is also a unity forum discussing this issue.
Threading Not Allowed:
1. You cannot use Threads in unity WebGL. Here is the error that you will get when the thread try to start:SystemException: Thread creation failed.
UnityLoader.js:4 at System.Threading.Thread.StartInternal (System.Security.Principal.IPrincipal principal, System.Threading.StackCrawlMark& stackMark) [0x00000] in <00000000000000000000000000000000>:0
GameDev Question
Unity Forum
Unity Webgl Doc
Update: Unity claim that in Version 2019.1.0 they added multiple Multithreading support but it was not working according to my test and now I also find this that there was a bug with the problem which has been fixed in Unity 2020.1.0 and Unity 2019.4.7 (untested).
Browsers that support shared array buffer may use thread support in WebGL.
Input Key Press Bug
2. If you are continuously pressing any keyboard input key and meanwhile you lost focus to the WebGL canvas in the browser, the input will still work even after releasing the key. The situation may get worst in the Edge browser.
Ref:
SE Question
Maybe resolved in Unity 2019.3.0 but I have tested and still, the same problem is happening.
Ref:
SE Question
Maybe resolved in Unity 2019.3.0 but I have tested and still, the same problem is happening.
WebGL Unload/Memory Clean Issue:
3. There is no unload method for WebGL in the browser. But in the recent unity version (Unity 2019 beta), you can use the Quit function. But there is still a problem in that memory cleanup is not done after executing the quit method.
Ref:SE Question
Unity Forum
SE Question
File reading possible workaround is to convert your files into strings. Like with U3D you can convert excel to a CSV file and use CSV file string. Check U3d Excel Github
SE Question
SE Question
7. You cannot get the return value from SendMessage function.
SE Question
SE Question
The same problem can happen in chrome if you view the WebGL page with chrome dev Tools open.
SE Question
SE Question
JSLib No Error Detection:
5. There is no way to detect an error in JSLib File that you usually write for interaction with browser script (JS). The error will be shown in the browser after building the player for WebGL. This can be time-consuming if your WebGL takes too much time to build. Remember for faster build time you can either disable compression or you can use GZip compression instead Brotli.
Ref:SE Question
SendMessage Limitations:
6. You cannot send an array data type SendMessage function when interacting with Unity player in the browser.SE Question
7. You cannot get the return value from SendMessage function.
SE Question
Learn More: Essential Packages for Unity Projects.
Don't Use WWW:
8. Don't use WWW.LoadFromCacheOrDownload for loading asset bundles. It is a memory consumer.SE Question
Firefox memory Increment Issue:
9. Firefox keeps incrementing the memory when you refresh your Webgl page in the browser.The same problem can happen in chrome if you view the WebGL page with chrome dev Tools open.
SE Question
WebGL unsupported on Mobile:
10. Unity Webgl Doesn't support mobile browsers. You may run it but without any guarantee.SE Question
But Wait recent beta Unity 2022 is allowing Unity WebGL mobile.
Unity Forum
Update: Unity Claim that he has resolved this error in Unity 2019.2.0
WebGL Sometime doesn't Get Load:
11. Sometime your Webgl will not load in the browser. Open the console and you will get "[UnityCache] indexedDB database could not be opened Error". Solve by extending the time.Unity Forum
Update: Unity Claim that he has resolved this error in Unity 2019.2.0
GPU instancing can be killing- Freez game on startup.
12. Randomly I found that if you are using GPU instancing then, it freezes your game for some time on asset bundle loading. See below details:
Unity Forum
GameDev Question
Unity Forum
GameDev Question
Control WebGL Input
13. By default your WebGL canvas will consume all keyboard input in the browser. You can use this (WebGLInput.captureAllKeyboardInput) to switch keyboard input control with other page elements and unity WebGL canvas.
Unity Docs
Bonus - Two Unity Webgl Tips
14. If your WebGL takes much CPU usage, then, you can control it by setting Application.targetFrameRate to a desirable number. Or you can also use Run in Background check to stop the application if it loses browser focus.
15. You may lose your Scripting define symbols when converting to the unity WebGL platform. (Make backup of your scripting define symbols before converting it to webgl)
0 Comments