Strange profiling data for WebGL build

I’m deep profiling my WebGL build and I sometimes see strange data.

Most of the time, the CPU usage hierarchy looks like this, with my scripts under BehaviourUpdate:

But sometimes, the CPU usage graph suddenly goes way up, and the hierarchy looks like this:

When I switch focus to the profiler window and then back to the browser, things go back to normal. I’m not sure if going into this strange state correlates with performance problems in my game. At least once, I’ve seen my game performing just fine while the profiler is in this state. My own FPS counter shows it running at 60fps but the profiler graph shows frames taking much longer than 16ms.

Does anyone know what is going on here? Should I file a bug?

Platform details:

  • Unity 6000.0.37f1
  • Macbook Pro 15-inch 2019 (Intel i9)
  • MacOS Sequoia 15.2
  • WebGL development build with deep profiling enabled
  • Firefox 135.0 (64-bit)
  • Built-in render pipeline
1 Like

I think this could happen when profiler can’t keep up with sending the data and stops
It could be that on WebGL the data was not discarded completely and we picked up previous frame’s stack when resuming.

Could you please try expanding profiler memory usage with adding -profiler-maxusedmemory 200000000 to the webgl arguments to see if that help with such frames reduction.

I think it would be very helpful to file a bug, thanks!

1 Like

What are webgl arguments, and how do I add something to them?

Is this the same as setting Profiler.maxUsedMemory from my C# code? The default value of that field is already higher than your suggested value (536870912)

yes, it is exactly the same setting