Unity 执行顺序
2017-05-10 本文已影响0人
木子才

对象有三个C#文件,那么他们的执行顺序是怎么样的呢。
一般来说,我们都会觉得他是从上到下执行的,而且unity却不是这样。是从下到上的执行顺序。
public class test01 : MonoBehaviour {
// Use this for initialization
void Start () {
Debug.Log ("test 01.....");
}
// Update is called once per frame
void Update () {
}
}
public class test02 : MonoBehaviour {
// Use this for initialization
void Start () {
Debug.Log ("test 02.....");
}
// Update is called once per frame
void Update () {
}
}
public class test03 : MonoBehaviour {
// Use this for initialization
void Start () {
Debug.Log ("test 03.....");
}
// Update is called once per frame
void Update () {
}
}
最后的结果是。。。

好吧,真的最初的时候没有想到这么一回事,要好好记录才行啊。