I have a few dozen sprites, and a couple of simple scripts. Nothing has an update function yet. When I load it, it’s nice and fast, but pretty rapidly it slows down. Over the course of a few minutes, the Update Time entry in the profiler goes from 0.5ms on my desktop to 3ms. On mobile it’s much worse, rapidly climbing up to 20ms. This seems like a bug, but I can’t work out what else I can do to debug where!
@Chris_Subagio Just a thought since we can not see the code. Please do a search for objects being created but not destroyed. Some place or keywords would be like .clone or instantiate. You may be able to have a look into the browser inspector to capture it. How are the sprites being created?
No cloning, no instantiation, no update functions in scripts. Even for the few functions written (a camera control script), I’m recycling a handful of Vec3s, rather than newing them in the events. Literally just a scene with a few sprites in it, from two texture atlases. I think I have sorting disabled for the layers, no camera culling. It’s baffling!
The scene itself is growing now, as I have to finish this evaluation quickly, but I’d appreciate it if folks could tell me if they’ve had any similar experiences?
Found it! For some reason I thought I needed an AudioListener to hear anything, so I had one sitting in the scene, under a 2D Screen. I don’t know what the mechanism was, but its update was the one growing over time. I don’t know if the faulty mechanism applies to any other entities or components (somewhat concerningly the labels that showed up in Chrome performance tab were I think update position and update orientation), but so far I’ve removed the listener and then added a few dozen other things in the scene with update functions, and I haven’t seen the same degradation over time.
Does anyone else have any experience with the AudioListener and or any other components or combination of components that cause runaway CPU usage like this?