Unity Awake vs Start, which one you should use

Unity has a lot of predefined functions that you can use in your game scripting. Awake and Start are two of such functions. But, there is so much confusion on these functions that Unity Awake vs Start is one of the most searched terms online. In this post, we will see how these functions work and which one to be used where. In all my years of game development, I didn’t need to use the Awake function much. Most of my game scripts comprise the Start function. Awake is used very rarely in scripts and can be very useful at some times.

The functional difference between awake and start is based on how the scripts and gameobjects are called in the scene. Awake is called when the script of the object is added to the scene and Start is called when the script starts doing something. This is just a basic idea of when Start and Awake functions are called.

Unity Awake vs Start

Let’s Start with what Unity says

Unity Awake () function

Awake is called when the script instance is being loaded. Awake is called either when an active GameObject that contains the script is initialized when a Scene loads, or when a previously inactive GameObject is set to active.

Unity documentation

Unity Start() Function

Start is called on the frame when a script is enabled just before any of the Update methods are called the first time.

Unity documentation

Now let’s try and understand what they say.

Awake function in a script of a gameobjects is called when the scene containing the gameobject is loaded. The only time Awake is not loaded is when the gameobject is disabled.

The Start function is called when the script is initialized. If you keep the script disabled then Start will not be called.

The common thing about Unity Start and Awake function is both these functions get called only once and both the functions are called after object initialization. So, it is safe to check for other gameobjects in the scene in both Awake and Start.

Unity Awake and Start basic comparison table

Order of ExecutionFirst Function to be calledStart is called after the Awake and OnEnable
Called when Gameobject is active and script is disabledYesNo
Can be delayedNoYes
Can be used as a coroutineNoYes
Number of times it can be called in the scripts lifetimeOnceOnce

Unity Awake vs Start with examples

Testing Unity Awake()

Let’s take 3 Gameobjects in a scene g1,g2,g3. I will add a script to each game object with an Awake and a Start function. Inside all these functions I will add a debug log. Here is the sample code. The debug log contains the number based on the gameobject, i.e in g1, it’s awake1, and in g2 it’s awake 2 so on.

using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 public class test3 : MonoBehaviour
     void Awake()
         Debug.Log ("Awake1 called");
     void Start()

Scenario one: All gameobjects and scripts are enabled.

In this scenario, we will keep all the gameobjects and their respective scripts enabled. Then let’s hit play and see the debug log.

When the game scene was loaded Awake() of all the gameobjects are called. All three debug logs get displayed on the console.

Scenario Two: All scripts in Gameobjects are disabled, but the gameobjects are active.

We will keep the gameobjects active in the hierarchy but disable the script attached to all the gameobjects.

Unity awake with scripts disabled.

Even when the scripts were disabled, their Awake() function was called. This shows that irrespective of the status of the script the awake function is called if the gameobject is active in the hierarchy.

Scenario Three: Mixing things up to see the result.

g1 and it’s script is enabled, g2 script is disabled in inspector and g3 gameobject is disabled in the hierarchy.

Unity awake with some scripts and some game objects disabled.

Awake of g1 and g2 got called but g3 was not called. Now let’s enable g3. As soon as I enabled g3 the Awake function gets called.

The conclusion from the above experiment. Awake function will be called at scene load if the object is set active even if the script is disabled.

Testing Unity Start()

I am going to use the same setup and scenario which was used for testing Awake. I will shift the log statement to the Start function. Same gameobject g1,g2,g3 are used for testing the Start function.

Scenario One: All gameobjects and scripts are enabled

Unity start with all enabled

All start function gets called on scene load. You can see all the debug log appearing on the console window.

Scenario Two:All scripts in Gameobjects are disabled, but the gameobjects are enabled.

Unity start with scripts disabled

None of the start functions are called in this case. Unlike the Awake function, the Start function is not called if the script is disabled.

Scenario three: g1 and it’s script are enabled, g2 script is disabled and g3 gameobject is disabled

Unity start with some scripts enabled and some game objects enabled.

Start function of g1 is called but g2 and g3 are not called. When I enable the script attached to g2 the Start function gets called.

This makes it more clear that the Awake function is more gameobject dependent and the Start function is more script dependent.

Awake Comes first

In the order of execution, the Awake function comes before the Start function. That is if you have both Awake and Start in the same script then the code in Awake gets executed before Start. This can be useful in scenarios where you want some variable to be initialized before spawning the enemy or player.

For Example, if you need to set the inventory items before the player gets spawned then you can do it in the Awake function.

Start can be delayed but not awake

One unique feature of the Unity start function is that it can be used as a coroutine. To use the Start function as coroutine you need to specify the Start function to return an IEnumerator and use the yield return statement.

Unlike Start the Awake function cannot be delayed. It will be called as soon as the gameobject get active in the scene. Here is a sample script to delay the Start function.

 IEnumerator Start()
     yield return new WaitForSeconds(5f);
     //rest of the code

Does SetActive() call Awake and Start?

As we saw in the above scenarios, both Awake and Start are not called if the gameobject is set to not active. But when you set the gameobject to active using the SetActive function, Awake is called irrespective of whether the script is active or not. Start is called only if the script is active.

Still, confused? Let’s see an Analogy of Unity awake vs Start

Take a team of 20 people being considered by the selection board for a football match. Out of these 20, only 15 will be in the squad and only 11 will play the game.

Let’s do a Unity Awake vs Start comparison with these players. Assume that an Awake() and a Start() function is attached to all these players.

Players who are not in the squad are like disabled gameobjects. Their Awake() function never gets called. Only the player who makes it to the squad gets their Awake functions called.

When the squad is announced the Awake() function of the 15 players in the squad gets called and when the match starts only the playing 11’s Start function gets called and when a player is substituted, at that time the Start function of the player entering the ground is called. But, the Awake function of the substituted player is called well before the substitution.

Should I use awake or Start?

In most of the cases it doesn’t matter but a small mistake like disabling the script can differ the Start function from being called and sometimes Awake will be called even when you thought you disabled the script. Here is the best way to use Awake and Start.

  1. Initializing public variable- Better done in Awake, as other gameobject might reference them.
  2. Checking for gameobjects and their components- can be done in both Awake and Start.
  3. Initializing gameobject specific variable like health- Better to be done in Start.
  4. Need delayed Initialization- Can be done in Start, Awake call cannot be delayed.
  5. Set all player ammo to zero on scene load- can be done in Awake. Ammo will be set to zero even if the script is disabled.

Hope this has cleared your doubts on Unity Awake vs Start functions. If you have any other queries, feel free to leave a comment below. You can also check out more Unity tutorials here.

2 thoughts on “Unity Awake vs Start, which one you should use”

  1. So if I have a disabled script attached to an active gameobject with an Awake function then it will be called. This was the mistake in my code. I searched for so long. Thank you.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.