Unity - 如果我用自己的 Start() 方法创建两个脚本,哪个会先调用?
Unity - If I create two scripts with its own Start() method, which one will call first?
我创建了两个简单的脚本(ScriptA 和 ScriptB)。两者都包含 Start() 方法。
我发现后一个总是先开始。这是Unity的正常做法吗?
By default, the Awake, OnEnable and Update functions of different
scripts are called in the order the scripts are loaded (which is
arbitrary). However, it is possible to modify this order using the
Script Execution Order settings (menu: Edit > Project Settings >
Script Execution Order).
我创建了两个简单的脚本(ScriptA 和 ScriptB)。两者都包含 Start() 方法。 我发现后一个总是先开始。这是Unity的正常做法吗?
By default, the Awake, OnEnable and Update functions of different scripts are called in the order the scripts are loaded (which is arbitrary). However, it is possible to modify this order using the Script Execution Order settings (menu: Edit > Project Settings > Script Execution Order).