What is the general use of Awake(), Start(), Update(), FixedUpdate(), LateUpdate()?

Can you please provide me with some general usage examples of the following methods in the MonoBehaviour class.

For Initiating:


  1. Why do we have two initiation methods?
  2. What are the differences?
  3. What are the best practices when using them?

For Updating:


  1. Why three different update methods?
  2. What are the differences?
  3. ... and again some best practices?

This really is something that is well covered in the scripting reference, so I'll just link to the descriptions:

Quoting from the docs:

The difference between Awake and Start is that Start is only called if the script instance is enabled. This allows you to delay any initialization code, until it is really needed. Awake is always called before any Start functions. This allows you to order initialization of scripts.

LateUpdate is called after all Update functions have been called. This is useful to order script execution. For example a follow camera should always be implemented in LateUpdate because it tracks objects that might have moved inside Update.

Also note that LateUpdate is called after animations are applied - this means you can implement procedural animation in LateUpdate which modifies the pose sampled by the animation system.

FixedUpdate is called every fixed framerate frame, if the MonoBehaviour is enabled. FixedUpdate should be used instead of Update when dealing with Rigidbody. For example when adding a force to a rigidbody, you have to apply the force every fixed frame inside FixedUpdate instead of every frame inside Update.

I hope that helps. You can read more about overridable functions on the scripting reference page for MonoBehaviour.

You can also read here about the Update Order.

Regarding Awake and Start, I treat Awake as "initialize me" and Start as "initialize my connections to others." You can't rely on the state of other objects during Awake, since they may not have Awoken themselves yet, so it's not safe to call their methods. Once you get to Start, all objects are Awake and can call each other.

Also I'd like to add this quickstart-overview form the forums

http://forum.unity3d.com/viewtopic.php?t=2719 ( also read the rest of the thread! )

These go some deeper about execution-order:

the Wiki-page http://www.unifycommunity.com/wiki/index.php?title=Event_Execution_Order


(example of co-routines fitting between Update and Late-Update as Mr. Ante described in the forum-post above)


(executionorder of invoke vs. co-routine)

Greetz, Ky.

Here is an additional link from the Unity Manual


if anyone else stumbles into this, all the info above was helpful, but I also liked the examples in this video


If need more explanation you can refer to http://www.unityrealm.com/monobehaviour-unity-basic-tips/

Anyone struggling to understand the difference can take a look at this. Tested in Unity Editor