- Home /
Stats greatly fluctuating. Do not know what is causing it.
So I am currently working on a group project in Unity 5. We are struggling with framerate issues at the moment. When taking a look at the stats they greatly fluctuate very rapidly. Examples of this is setpass calls changing between 80 and 6000, tris changing between 70 000 and 1,7 million and batches changing between 160 and 7500.
Below are two screen caps taken only a second apart (note the changes in the stats window): http://i.imgur.com/rA6wXy2.png and http://i.imgur.com/wQxeeuZ.png
Can someone give some insight into what might be causing this behaviour ?
Answer by Graham-Dunnett · May 18, 2015 at 10:39 AM
Time to learn how to use the profiler in 5.x.
I'm just a bit stunned... Is the profiler now available for free users as well? o.O At least it seems so. When was that changed? 5.0+?
Anyways that's awesome ^^
Answer by Bunny83 · May 18, 2015 at 11:00 AM
I suggest you do the following steps:
If you have Unity pro, use the profiler to see what's going on.
If not follow these steps:
Backup your project
Run the game in the editor and collapse all gameobjects in the hierarchy.
Start deleting the gameobjects one after another
See when it stops fluctuation.
Restart the game and only delete the object you deleted last
If the problem is gone, restart again, expand that object and delete it's childs, one after another.
If it wasn't solved by just deleting the last deleted top object, try to find out which top gameobjects has to be deleted together to solve the problem
If you get a NullReference exception after deleting an object, it's the best time to insert some null-checks into those scripts ^^.
Once you have isolated the problem think about what scripts are attached to those object(s) and it's childs. What do they do / change each frame. What other components are involved? Particlesystems, Rigidbodies, GUI, Renderer
Additionally you might want to press the pause button in the editor and step through your game (the button on the left of the pause button). Do you see any pattern? Switching each frame? About every X frames?
Thank you very much! Because this is our first project in unity we are sometimes struggling even with the basics :)
Following your steps helped alot. By looking at what was using alot of resources in the profiler I managed to narrow it down to a realtime reflection probe. After deleting it from the scene the fluctuating stopped.
I also managed to find another problem that seems to be causing framerate issues. An enemy type in our game is a swarm of bats that fly in patterns that the player has to avoid. Each bat has a behaviour, joints and animations and apparently these are still continually calculated constantly even when far out of sight leading to behaviours for possibly thousands of bats (all bats in the level) being processed all the time. A blunder on our side. Since unity has automatic frustum culling i guess we kind of assumed the bats behaviours would also be "culled" in some way.
Do you have a tip on a standard way to take care of this?
Your answer
Follow this Question
Related Questions
Stats Greatly fluctuating. Do not know what is causing it. 0 Answers
Fast line rendering in 2D/3D 0 Answers
Need some clarification how the batches stats affects performance. 0 Answers
Updated to 2021.3.3, why did my FPS drop significantly? (over 350fps) 0 Answers
Why so many SetPass Calls? 1 Answer