Exact order of operations to render a frame (character animation problem)

Hi all,

My question: is there a description somewhere of the exact order of operations to render a frame in Unity?

I'm interested in this because I have a problem with character animation. It seems that the transformations of bones in a character are 'lagging one frame behind'. I mean that if you read the position of a bone in LateUpdate(), that position is not the one used in the subsequent render. I think the Unity loop looks like this:

... frame x - 1 : Animate and render bones and everything else

frame x : call Updates

frame x : Update bone transforms with data from frame x - 1

frame x : call LateUpdates

frame x : Animate and render bones and everything else

frame x + 1 : call Updates ...

I noticed this when examining the position of the root node in my character animation. When you start playing a new animation in Update(), the root node position read in LateUpdate() is still the position of the old animation. The Unity documentation says "One important thing to know is that the animation system updates the Transforms after the Update() function and before the LateUpdate() function is called", but it doesn't say what the transforms are updated with: data from previous render or subsequent render?

Thanks, Mattijs

My question: is there a description somewhere of the exact order of operations to render a frame in Unity?

Check the manual on Execution Order. Unify Wiki also have an article about it.

So in conclusion, this is the execution order for any given script:

  • All Awake calls
  • All Start Calls
  • while (stepping towards variable delta time)
    • All FixedUpdate functions
    • Physics simulation
    • OnEnter/Exit/Stay trigger functions
    • OnEnter/Exit/Stay collision functions
  • Rigidbody interpolation applies transform.position and rotation
  • OnMouseDown/OnMouseUp etc. events
  • All Update functions
  • Animations are advanced, blended and applied to transform
  • All LateUpdate functions
  • Rendering