Got stuck in a performance issue in Unity WebGL that whenever my asset bundles are load, my unity game gets freeze for some seconds/minutes. I know that unity is not thread-safe and it is based on a single thread but these statements are confusing for me. From the official sites/persons of unity:
Lack of threading support in JS? Does it mean it supports on the desktop?
Since WebGL does not support threading, and since HTTP downloads will only become available when finished, Unity WebGL builds need to decompress AssetBundle data on the main thread when the download is done, thus blocking the main thread. To avoid this interruption, you may want to avoid using the default LZMA Format for your AssetBundles, and compress using LZ4 instead, which is decompressed very efficiently on-demand. If you need smaller compression sizes then LZ4 delivers, you can configure your webserver to gzip-compress the files on the http protocol level (on top of LZ4 compression) (Source Unity Forum/Offical 2).
Here is saying doesn't support threading but the asset bundle is load in the main thread? Do it support thread? It sounds confusing to me.
WebGL does not support threads, so the Async operation is running on the main thread causing the freeze that you are seeing (Source Unity Forum/offical). Blockquote
Doesn't support thread but asset bundle loading in the main thread??
These statements are confusing for me? Do unity supports thread? If Not then, What is the
main thread? Why unity repeatedly call that asset bundle is load in main thread? If unity doesn't support thread then how async/coroutine operation is performed?
Edit: Unity 2019.1 has released with this note WebGL: Added experimental multi-threading support. Do it means we can use thread now?