How do I find out what is using Fixed Update (and slowing the frame rate to around 5fps every 10 seconds or so)

Hi everyone,

I noticed every 10 seconds or so the frame rate of my game slows dramatically. I’ve used the Xcode console and I’ve worked out that it’s due to the fixed updates as this is the only thing that is different.

Normally there are 3-5 each time the console takes a reading from the device although when it slows it counts 15-20.

How can I find out where these Fixed updates are being used? I believe I only have a single fixed update function in one of my scripts (for the main character) - nowhere else, so what else could be using it? Does another function use Fixed update?

Or do you have any other suggestions?


EDIT: Here is the output of the Console in Xcode for one of the times where it slowed down a lot. If it’s not the Fixed Update that’s slowing everything down then does that mean it’s the physx? As that’s quite high. Although during the time that this reading occured I don’t believe there would have been any more calculations for the Physx as I was doing exactly the same thing as normal in the game. (No special buttons were pressed, or abnormal animations on screen etc…)

iPhone Unity internal profiler stats:

cpu-player> min: 47.2 max: 513.7 avg: 105.8

cpu-ogles-drv> min: 1.9 max: 8.3 avg: 2.5

cpu-waits-gpu> min: 0.2 max: 0.8 avg: 0.2

msaa-resolve> min: 0.0 max: 0.0 avg: 0.0

cpu-present> min: 0.8 max: 11.6 avg: 1.5

frametime> min: 57.7 max: 526.9 avg: 113.5

draw-call #> min: 42 max: 46 avg: 43 | batched: 1

tris #> min: 10067 max: 12326 avg: 11095 | batched: 126

verts #> min: 5065 max: 6219 avg: 5605 | batched: 86

player-detail> physx: 62.9 animation: 14.9 culling 0.0 skinning: 1.3 batching: 0.0 render: 6.5 fixed-update-count: 3 … 25

mono-scripts> update: 13.8 fixedUpdate: 2.2 coroutines: 0.1

mono-memory> used heap: 610304 allocated heap: 2387968 max number of collections: 0 collection total duration: 0.0

This can be compared to the normal reading (and frame rate) I get the majority of the time which gives the following as output from Xcode.

iPhone Unity internal profiler stats:

cpu-player> min: 47.8 max: 73.7 avg: 57.2

cpu-ogles-drv> min: 1.9 max: 9.2 avg: 2.6

cpu-waits-gpu> min: 0.2 max: 0.3 avg: 0.2

msaa-resolve> min: 0.0 max: 0.0 avg: 0.0

cpu-present> min: 0.9 max: 6.7 avg: 1.3

frametime> min: 54.9 max: 87.0 avg: 65.0

draw-call #> min: 41 max: 44 avg: 42 | batched: 0

tris #> min: 7899 max: 10847 avg: 9340 | batched: 0

verts #> min: 4009 max: 5433 avg: 4711 | batched: 0

player-detail> physx: 33.2 animation: 5.3 culling 0.0 skinning: 1.2 batching: 0.0 render: 5.9 fixed-update-count: 3 … 4

mono-scripts> update: 8.8 fixedUpdate: 1.1 coroutines: 0.0

mono-memory> used heap: 716800 allocated heap: 2387968 max number of collections: 0 collection total duration: 0.0

You can see that of the two readings, the one that really slows on the device as a greater ‘cpu-player’ max, higher FixedUpdate count as well as Physx and animation values.

Perhaps it’s something to do with the CPU? If so, would that only be possibly affected by the scripts running and therefore I need to look there?

Thanks in advance for any light you can shed on this!

Unity Forums thread on same issue;

Do you have any processes timed to go about every 10 seconds? Like polling a server? (LateUpdate or Update or otherwise). If not, sounds like it’s probably doing garbage collection. You might want to make sure you aren’t leaking stuff. Make sure you destroy things that are no longer used. That kind of thing.