Friendly request to have the Execution Order diagram updated.
In its current state it suggests the following order
- Awake()
- OnEnable()
- Start()
I’ve come to learn the actual order is
- For each script call Awake() then OnEnable(), then go to the next script
- Start()
I imagine having an accurate diagram will help to avoid bugs / confusion for future devs.
Thanks in advance.
Hmmm. Guess you’re right. I think the “3. Start()” isn’t meant to mean Start() instantly follows OnEnable(). I’ll see if the docs team can fix this.
using UnityEngine;
public class test1 : MonoBehaviour {
void Awake()
{
Debug.Log("test1: Awake");
}
void OnEnable()
{
Debug.Log("test1: OnEnable");
}
void Start()
{
Debug.Log("test1: Start");
}
}
using UnityEngine;
public class test2 : MonoBehaviour {
void Awake()
{
Debug.Log("test2: Awake");
}
void OnEnable()
{
Debug.Log("test2: OnEnable");
}
void Start()
{
Debug.Log("test2: Start");
}
}
test1: Awake
test1: OnEnable
test2: Awake
test2: OnEnable
test1: Start
test2: Start