Start vs Awake in Unity: Key Differences and When to Use Each
Awake is called when the script instance is loaded, before any Start methods run. Start is called before the first frame update and only if the script is enabled, making Awake ideal for early setup and Start for initialization that depends on other objects.Quick Comparison
This table summarizes the main differences between Awake and Start methods in Unity.
| Factor | Awake | Start |
|---|---|---|
| Execution Time | Called when script instance loads | Called before first frame update |
| Execution Order | Runs before all Start methods | Runs after all Awake methods |
| Called If Script Enabled? | Yes, always called | Only if script is enabled |
| Use Case | Initialize variables and references | Initialize logic that depends on other objects |
| Frequency | Called once per script instance | Called once per script instance |
| Access to Other Components | Other components may not be initialized | Other components are initialized |
Key Differences
Awake is called immediately when the script instance is loaded, even if the script component is disabled. This makes it perfect for setting up internal references or variables that do not depend on other objects.
Start is called just before the first frame update but only if the script is enabled. This means Start is ideal for initialization that requires other objects or components to be fully initialized and active.
Another key difference is the execution order: all Awake methods run before any Start methods. This ensures that all objects have set up their internal state before any gameplay logic begins.
Awake Example
using UnityEngine; public class ExampleAwake : MonoBehaviour { private Rigidbody rb; void Awake() { // Cache the Rigidbody component early rb = GetComponent<Rigidbody>(); Debug.Log("Awake called: Rigidbody cached."); } void Start() { Debug.Log("Start called: Rigidbody is " + (rb != null ? "ready" : "missing")); } }
Start Equivalent
using UnityEngine; public class ExampleStart : MonoBehaviour { private Rigidbody rb; void Start() { // Cache the Rigidbody component here rb = GetComponent<Rigidbody>(); Debug.Log("Start called: Rigidbody cached."); } }
When to Use Which
Choose Awake when you need to initialize variables or references as soon as the script loads, regardless of whether the script is enabled. This is useful for setting up internal states or caching components.
Choose Start when your initialization depends on other objects or components being fully initialized and active. Use Start for gameplay logic that requires other scripts to be ready.
In summary, use Awake for early setup and Start for initialization that depends on the scene's active state.
Key Takeaways
Awake runs first when the script loads, even if disabled.Start runs before the first frame but only if enabled.Awake is best for internal setup; Start for dependent initialization.Awake calls finish before any Start runs.Start for logic needing other objects fully ready.