Recently we’ve upgraded our project to Unity 5.6.1p2 from 5.4.2f2 and noticed huge performance drop on ios devices(ipad air2 60fps droped to 30fps). After some investigation I noticed that the first version where our problem reproduced is 5.4.3p1.
In our project we’re using Time.fixedDeltaTime = 0.015, Application.targetFramerate = 60, QualitySettings.vSyncCount = 1.
I profiled project in 5.4.3f1 and 5.4.3p1 versions and got some strange results(I set screen resolution to very low and disabled all graphics effects to be sure that this is not GPU problem).
FixedUpdate doesn’t update independently from the game’s framerate, it just runs the correct number of times every frame right before Update, be it 0 times or 10 times-- the number of times depends on how much time passed since the last frame. If your physics step is slightly smaller than your target frame time (0.015 vs 1/60 = 0.01667) then there will be some frames where FixedUpdate runs twice to catch up to its target, or more if there are slow frames. If a really terrible frame clocks in at 0.1 seconds, then FixedUpdate will be called 6 times in a row before the next Update.
I know this doesn’t answer your question of why your game’s performance has declined, but it helps to know that this normal behavior. Let me know if I’m misunderstanding something.
Update and FixedUpdate may be considered two separate execution paths.
Update is called as much as possible based on VSync settings. Update frames may be skipped if necessary. Time.deltaTime is a variable value here.
FixedUpdate is called at the physics update rate given by Project Settings > Time > Fixed Timestep. No FixedUpdate frames will be ever skipped. Time.deltaTime here is always the fixed timestep.
There may be several Update calls between each FixedUpdate call. This is the most common scenario: Update runs at the maximum frame rate allowed by the hardware, and the FixedUpdate calls are interleaved between them at the proper rate.
But there may be many FixedUpdate calls between each Update call as well. This is typically an issue: the game is too intensive for the hardware so there are massive frame skips at Update. At the same time the physics must run at a constant rate without skipping any frame, so many FixedUpdate calls will occur until the hardware has a chance to issue the next Update cycle.
Maybe I asked my question not very clear. My problem is not an understanding how FixedUpdate and Update works, but why two sequenced versions of Unity produce such different results.
We have a project with physics and some network stuff:
In 5.4.3f1 all works great. In 5.4.3p1(first patch for this version) and later - not. I want to discover why, because changelog and my tests give me no answers.