Awake and Start are special methods in Unity that help set up your game objects. Knowing their order helps you control when things happen in your game.
Awake vs Start execution order in Unity
Introduction
Syntax
Unity
void Awake() {
// Initialization code here
}
void Start() {
// Code to run before first frame update
}Awake runs first on enabled scripts.
Start runs after Awake and only if the script is enabled.
Examples
Unity
void Awake() {
Debug.Log("Awake called");
}
void Start() {
Debug.Log("Start called");
}Unity
void Awake() {
playerHealth = 100;
}
void Start() {
Debug.Log($"Player health is {playerHealth}");
}Sample Program
This Unity script prints messages to show the order of Awake and Start methods.
Unity
using UnityEngine; public class ExecutionOrderExample : MonoBehaviour { void Awake() { Debug.Log("Awake called"); } void Start() { Debug.Log("Start called"); } }
Important Notes
Awake is used for setup that must happen before anything else.
Start is good for things that depend on other objects being ready.
If a script is disabled at initialization, Awake still runs. Start runs when the script is first enabled.
Summary
Awake runs first, used for early setup.
Start runs after Awake, used for setup before gameplay.
Understanding their order helps avoid bugs and timing issues.
Practice
1. In Unity, which method is called first when a scene loads:
Awake or Start?easy
Solution
Step 1: Understand Unity's initialization order
Unity callsAwakefirst to initialize objects early.Step 2: Recognize
StarttimingStartruns afterAwake, before gameplay begins.Final Answer:
Awakeis called beforeStart. -> Option AQuick Check:
Awake runs first = D [OK]
Hint: Remember: Awake sets up early, Start sets up later [OK]
Common Mistakes:
- Thinking Start runs before Awake
- Believing both run simultaneously
- Assuming methods need manual calls
2. Which of the following is the correct syntax to define the
Awake method in a Unity C# script?easy
Solution
Step 1: Recall Unity method syntax
Unity callsAwakeautomatically if defined asvoid Awake().Step 2: Check access modifiers
Awakeis usuallyprivateby default, sovoid Awake()is correct and common.Final Answer:
void Awake() { }-> Option CQuick Check:
Usevoid Awake()syntax [OK]
Hint: Awake method is usually defined as void Awake() [OK]
Common Mistakes:
- Adding public or private explicitly (not required)
- Using arrow syntax which is invalid here
- Omitting return type
3. Consider this Unity script attached to a GameObject:
What will be the order of messages in the Console when the scene starts?
void Awake() { Debug.Log("Awake called"); }
void Start() { Debug.Log("Start called"); }What will be the order of messages in the Console when the scene starts?
medium
Solution
Step 1: Identify method call order
Unity callsAwakefirst, so "Awake called" logs first.Step 2: Confirm
ThenStartruns afterAwakeStartruns, logging "Start called" second.Final Answer:
"Awake called" then "Start called" -> Option DQuick Check:
Awake logs first, Start logs second [OK]
Hint: Awake logs before Start logs in console [OK]
Common Mistakes:
- Assuming Start logs before Awake
- Thinking only one method logs
- Confusing method call timing
4. You wrote this script but
What is the problem?
Start never runs:void Awake() { Debug.Log("Awake"); }
void start() { Debug.Log("Start"); }What is the problem?
medium
Solution
Step 1: Check method names for case sensitivity
Unity requires exact method names;Startmust be capitalized.Step 2: Understand Unity's method calling rules
Lowercasestartis ignored, soStartnever runs.Final Answer:
startmethod name is lowercase, should beStart. -> Option BQuick Check:
Method names are case-sensitive [OK]
Hint: Check method names are exactly capitalized [OK]
Common Mistakes:
- Assuming Awake blocks Start
- Thinking public keyword is required
- Believing Unity calls lowercase methods
5. You have two scripts on different GameObjects:
What is the correct order of messages in the Console when the scene starts?
Script A:
void Awake() { Debug.Log("A Awake"); }
void Start() { Debug.Log("A Start"); }
Script B:
void Awake() { Debug.Log("B Awake"); }
void Start() { Debug.Log("B Start"); }
What is the correct order of messages in the Console when the scene starts?
hard
Solution
Step 1: Understand Awake runs on all objects first
Unity calls allAwakemethods before anyStartmethods.Step 2: Recognize Start runs after all Awake calls
After allAwakecalls, Unity calls allStartmethods.Final Answer:
"A Awake", "B Awake", "A Start", "B Start" -> Option AQuick Check:
All Awake first, then all Start [OK]
Hint: All Awake run before any Start runs [OK]
Common Mistakes:
- Thinking Awake and Start alternate per object
- Assuming Start runs before Awake
- Believing order between objects is random
Recommended
Ready to prove it?
Pass the test and this pattern moves unknown
10 questions ~5 mineasy hard
