美文网首页
Unity 执行顺序

Unity 执行顺序

作者: 木子才 | 来源:发表于2017-05-10 13:51 被阅读0次
D7E0E3FF-E790-4243-A004-538D83161ABD.png

对象有三个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 () {
        
    }
}

最后的结果是。。。

1FD527BC-AB82-4FE1-835E-C16E49CE4C7A.png

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

相关文章

网友评论

      本文标题:Unity 执行顺序

      本文链接:https://www.haomeiwen.com/subject/ndfgtxtx.html