Awake vs Start
- Game Development course
- Beginner
- Lesson 34/83
- 4 min
Learn the difference and order between Awake and Start.
What is Awake?
The Awake method is called the moment the object is loaded into the scene. It runs before Start and is the first step of game preparation.
void Awake()
{
Debug.Log("Awake");
}The order on an object is this: Awake first, then Start, then Update.
The order between Awake and Start
Both Awake and Start run only once, but their order is fixed: Awake first, then Start. This is why you can safely use the values that Awake prepared inside Start.
void Awake()
{
ad = "Oyuncu";
}
void Start()
{
Debug.Log(ad);
}In the example above, the ad variable is already ready when Start runs.
Practice Show the order
Write a class named Sira. In Awake, print "Awake" with Debug.Log, and in Start, print "Start". This way the call order shows in the console.
Starter code
using UnityEngine;
public class Sira : MonoBehaviour
{
// Awake icinde "Awake", Start icinde "Start" yazdir
}Sample solution
using UnityEngine;
public class Sira : MonoBehaviour
{
void Awake()
{
Debug.Log("Awake");
}
void Start()
{
Debug.Log("Start");
}
}Expected output
Awake Start
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 When the two methods below run, in which order does the output appear?
void Awake()
{
Debug.Log("A");
}
void Start()
{
Debug.Log("B");
}- First B, then A
- A and B appear at the same time
- First A, then B Correct answer
- Only A appears
Explanation: Awake is called before Start, so A is logged first and then B.
2 Define the method that runs first
void ____()
{
Debug.Log("Awake");
}
void Start()
{
Debug.Log("Start");
}
void Awake()
{
Debug.Log("Awake");
}
void Start()
{
Debug.Log("Start");
}
Explanation: Awake is called before Start, so 'Awake' is printed first.
3 Order of Awake and Start
| Term | Meaning |
|---|---|
Awake() |
The startup method that runs first |
Start() |
The method that follows Awake |
Nesne yüklendiğinde |
The moment that triggers Awake |
İlk güncelleme |
Comes after Start |