Search code examples
c#unity-game-engineunity-webgl

Webgl build fps decrease over time (Chrome)?


We are working on optimizing our webgl build (intended to be run on chromebooks, chrome latest version). Currently we have achieved about ~40 fps throughout the game which is quite near our requirement.

The issue is that if the game is left "on" for some time (e.g 30-45 minutes), the fps gradually drop from the initial 40 fps to about 20 fps and then continue to decrease in the same manner if game is left on.

We can say this isnt due to gpu because in all our scenes the draw calls are about 100-150 and they stay constant. Furthermore we have optimized as far as gpu is considered (static/dynamic batching, gpu instancing, disabled shadows, texture compression etc).

Currently we are unable to profile the actual build (since the development build is about 2gb which cant be loaded in any browser), hence we are profiling the editor.

Deep profiling the cpu scripts doesnt reveal anything obvious that could be gradually eating up the fps over a period of 45 minutes.

Has anyone else encountered this in their WebGl builds? Any advice for optimization and maintaining a consistent fps?

Thanks.


Solution

  • Unity's audio source was causing the fps drop in the Webgl build. We replaced it with this asset and the fps drop vanished.