Deadly slow loading on WebGL

Avatar
  • updated

When creating a webgl build sometimes it takes more than a 30 seconds to load a scene with Shapes components. It's hard to reproduce, because it works only on some machines, but when if machine is subject to bug it is consistent. It appears that issue exists on M1 MacBook airs (tested on two different ones) and sometimes on Windows machines, too, but on a very few 

Profiling scene showed that apparently it's Shader.CreateGpuProgram which makes such a delay (Still investigating and checking it). So the question is why it's so inconsistent

Image 678


Steps to reproduce:

1. Create an empty project

2. Switch platform to WebGL

3. Add shapes to project

4. Put some shapes component (of different types) on scene 

5. Build 


Expected behaivor: After unity loading screen scene would be loaded instantly

Actual behaivor: On some devices it takes up to a few minutes (or even more) to load a scene 

The more different shapes on scene the more time it takes, possibly bcs more shaders it tries to compile

Reporting a bug? please specify Unity version:
2021.3.16f1
Reporting a bug? please specify Shapes version:
4.2.1
Reporting a bug? please specify Render Pipeline:
URP
Avatar
yogurt the horse

Should I expect any progress on that in near future? I'm not pushing, just interesting about situation with that bug

Avatar
Freya Holmér creator

this is most likely due to slow shader loading on WebGL, which is out of my control. the one thing you might want to look into is if unity is including too many shaders that you aren't using. if it's slow loading the ones you are including though, there's nothing I can do about it