Unity Scripting Order Reference Interactive MonoBehaviour lifecycle diagram. Click any callback to see its description and code example.
Understanding when each Unity callback runs is critical for avoiding bugs. Should you initialise references in Awake or Start? Where does camera follow code go? When do physics callbacks fire relative to Update? This interactive diagram shows the complete MonoBehaviour lifecycle with code examples for each event.
Lifecycle Flowchart Click any phase for code examples.
Initialisation Awake, OnEnable First Frame Start Physics FixedUpdate, OnCollision/Trigger loop Input OnMouse*, Input polling Game Logic Update Coroutines yield WaitForSeconds, etc. Late Game Logic LateUpdate Rendering OnWillRenderObject, OnGUI Decommissioning OnDisable, OnDestroy Execution Order
Initialisation 2
Awake() Once, when the script instance is loaded OnEnable() Each time the object becomes active
First Frame 1
Start() Once, before the first frame update
Physics 3
FixedUpdate() Every fixed timestep (default 0.02s / 50Hz) OnTriggerEnter/Stay/Exit() During physics step when triggers overlap OnCollisionEnter/Stay/Exit() During physics step on collision
Late Game Logic 1
LateUpdate() Once per frame, after all Update calls
Rendering 4
OnBecameVisible/Invisible() When renderer visibility changes OnPreRender/OnPostRender() Before/after camera renders the scene OnRenderObject() After camera renders OnGUI() Multiple times per frame (legacy)
Coroutines 4
yield return null After Update, before LateUpdate yield return new WaitForFixedUpdate() After FixedUpdate yield return new WaitForEndOfFrame() After rendering is complete yield return new WaitForSeconds(n) After n seconds of game time Decommissioning 3
OnDisable() When the object becomes inactive OnDestroy() When the object is destroyed OnApplicationQuit() When the application is about to quit When Does X Run? Where should I put physics code? FixedUpdate Where should I put camera follow? LateUpdate Where should I put input handling? Update Where should I initialise references? Awake (self) or Start (cross-object) Where should I subscribe to events? OnEnable (unsubscribe in OnDisable)
Related Tools DOTween Reference Searchable DOTween cheat sheet with copy-paste Unity C# code for every common tween method.
Easing Visualiser Interactive curves with Unity code output. DOTween, LeanTween, and AnimationCurve snippets for every standard easing function.
Game Maths Interactive cheat sheet with live visualisations. Distance, lerp, dot product, vectors, and more with Unity C# code.
Input Mapping Every keycode, gamepad button, and mouse input with Unity, Unreal, and Godot code.