Another Question about Execution Order

Let’s say there are scripts a and b.

Is the order:

a Update → b Update → a LateUpdate → b LateUpdate

or

a Update → a LateUpdate → b Update → b LateUpdate?

To my understanding of Execution Order of Event Functions, Update is fired first across all MonoBehaviours, then LateUpdate passes across them. So the first line you typed is the correct interpretation.


a Update → b Update → a LateUpdate → b LateUpdate


I did an experiment for this to confirm: I created ScriptA and ScriptB, which are mostly clones of one another, with exception to what they log to the console. The result is in an image I’ve attached.


133237-screen-shot-2019-02-16-at-92427-pm.png


public class ScriptA : MonoBehaviour {
	bool loggedUpdate = false;
	bool loggedLate = false;
	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		if (!loggedUpdate)
		{
			Debug.Log("A UPDATE");
			loggedUpdate = true;
		}
	}

	void LateUpdate()
	{
		if (!loggedLate)
		{
			Debug.Log ("A LATE");
			loggedLate = true;
		}
	}
}