Low framerate for first ~20 seconds when testing game in Unity

Hello, first time game maker, first time writer.
I'm creating a relatively small Unity game that involves no more than turning objects on and off and collecting some items.
When testing the game, the framerate is somewhere around 0.5 and the CPU main hits up to 2000 ms. After about 20 seconds, it runs perfectly fine without any issues. I am not using any extensive packages or assets, this began after I was testing out some code for a moving platform. See screen shot for specs.

Anyone know why this might be?
Running on Mac M1 8gb ram, Unity 2021.3.19f1
Thanks
E

9016120--1243273--Screenshot 2023-05-15 at 15.19.53.png

Please show use more content. It is impossible for us to guess work.

Your scene has lots of features, so chances is, anything else is happening.
Use profiler, to see what is going on.

Also, is looks like it belongs to getting started, or scripting sub-forum.

1 Like

I would learn how to use the profiler to figure what exactly is drawing so much overhead, then you can focus on that specific issue.

1 Like

Just a thought: if you have a large stack of physics objects they will slow everything down while the ycontinue to collide with each other and this behaviour eventually settles when the number of contacts gets less and/or bodies fall asleep.

The naive cube-of-cubes „voxel“ approach will lead to such an issue for example.

2 Likes

Much appreciated! I had a look and familiarised myself with the Profiler, but the issue in the end was indeed too many objects colliding with each other. Deactivated a few and it runs normal again. Thanks!

2 Likes


I recommend moving to a higher amount of memory as soon as you're able to afford it. I have an M1 w/ 16GB RAM that I use for making builds. With just Unity and the processes needed for the OS I never see more than a few GBs free. Just 8GB isn't going to be viable for very long.

Modern OSes are designed to avoid running out of memory completely by using the drives in the system as a form of memory but there is a substantial performance penalty associated with that not to mention it increases the wear and tear on the drives shortening their lifespan.