记一下关于Instantiate时Awake Start的执行

来源:互联网 发布:如何连接宽带网络 编辑:程序博客网 时间:2024/06/16 02:28

Root 

using UnityEngine;using System.Collections;public class RootScript : MonoBehaviour {    public GameObject profab;    void Awake()    {        Debug.Log(Time.time + "Root Awake");    }// Use this for initializationvoid Start () {        Debug.Log(Time.time + "Root Start");        Invoke("startLoadUI", 0.1f);}private void startLoadUI()    {        GameObject go = Instantiate(profab) as GameObject;    }}


Child

using UnityEngine;using System.Collections;public class ChildScript : MonoBehaviour {    void Awake()    {        Debug.Log(Time.time + "Child Awake");    }// Use this for initializationvoid Start () {        Debug.Log(Time.time + "Child Start");    }// Update is called once per framevoid Update () {}}


运行结果







0 0
原创粉丝点击