So. I have a platformer project. And about 30 minutes in, no matter what you do, CPU usage suddenly goes up. The project involves switching between a lot of scenes. But as it turns out, changing scenes is not an issue. Because, reportedly, one can just stand for 30 minutes in one level and get the bug as well. What I’ve found out so far:
- I ran a profiler. It remained consistent throughout the scenes with about 25% use of objects and 50% for events. I think the other 25% were events too. But that’s to be expected.
- During the lag spike, events suddenly go up to 100% usage and have a 203ms response time. The culprits are inconsistent since it shows the character’s FSM is to blame. But it didn’t seem to use a lot of CPU before that. Events running constantly and somehow adding up doesn’t seem to be an issue either.
- I managed to switch back to the Menu scene despite the lags. Cleared the storage. Launched the “first” scene once more without closing the preview. It worked again but with an occasional stutter. For a few scene changes. After which the lag and CPU usage came back.
So yeah. Bottom point is that regardless of whether you go through 60 scenes or stay at one scene for half an hour, it starts lagging. I can send the project if any GD devs are willing to look at it. On a side note, this thread mentions a similar issue:
Update: It seems like the amount of scenes is to blame after all. Specifically, the amount of individual scenes with their own objects. The number varies from 166 scene changes (if changing “unique” scenes rapidly) to 260 (if revisiting already visited scenes several times). So the issue is certainly the amount of scene changes. Which the new update doesn’t handle as well, apparently.