UniVRM
UniVRM copied to clipboard
WebGL UniTask
Will u add UniTask Support for WebGL? since WebGL doesn't support multithreading, loading vrm at runtime will freeze the screen for a couple of seconds. tq
Convert every function to unitask with async await as much as possible. And testing unitask. Delay for few seconds to find out where it freeze, found out that UniJson parsing and deserialise cause most of the freeze. It is possible to remove json file or using more efficient json parsing for runtime import? I have open another issue on this json parsing.
UPDATE texture.LoadImage(textureInfo.ImageData);
texture LoadImage freeze 1/2 a seconds as well. trying to replace with LoadRawTextureData, althought it doesn't freeze but no colour loaded.
Thanks for your reporting. We do not support fully non-blocking loads in single-threaded environments such as WebGL.
If we supported UniTask officially, you won't get the results you want.
Because WebGL doesn't support multithreading and the method of parsing JSON is implemented by Task.Run
at current version.
Also blocking the main thread while loading texture is depend on internal UnityEngine's implementation.
new Texture2D()
always causes blocking the main thread.
for texture.loadimage maybe we can solve by using native renderingPlugin as mention in https://stackoverflow.com/questions/54749373/hololens-unity-loadimage-freezes-main-thread
or webglmovietexture as mention in https://stackoverflow.com/questions/56123201/unity-plugin-texture-is-immutable
i will try to implement it and reporting back.
You can implement ITextureDeserializer
with native plugin for your target environments and pass to importer constructor. 😉
UniTask works in WebGL as long as you're not using Task.Run or switching to the threadPool in general.
Thank me later: https://github.com/VolodymyrBS/WebGLThreadingPatcher This guy did an amazing job with some pretty hardcore IL generation Worked for me, using it for a few months already in a quite large project, .net standard 2.0 and 2.1
This issue has been labeled as "stale" due to no response by the reporter within 1 month (and 7 days after last commented by someone). And it will be closed automatically 14 days later if not responded.
This issue has been closed due to no response within 14 days after labeled as "stale", 7 days after last reopened, and 7 days after last commented.