If I attach two monobehaviour scripts to one GameObject,is the Update order predicable?
For example:
First I attach aaa.cs and then attach bbb.cs, unity engine will call
aaa.Update()
bbb.Update()
??
Very thanks.
If I attach two monobehaviour scripts to one GameObject,is the Update order predicable?
For example:
First I attach aaa.cs and then attach bbb.cs, unity engine will call
aaa.Update()
bbb.Update()
??
Very thanks.
Update is called once per frame, I don’t think that you would be able to predict which script is called first. Just did some testing and the script I attatched to the game object last got called first, but this can also be random, I’m not sure at all. May I ask what you need this for? ![]()
You can set the script execution order in Unity, which according to the 3.4 release notes
includes Update() commands.
Tutorial on how to set this is [here] 2
The order in which Update is called is undefined, so no, the order is not predictable, unless you use the script execution order which MIke mentioned.