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

Root 

using UnityEngine;
using System.Collections;

public class RootScript : MonoBehaviour {

    public GameObject profab;

    void Awake()
    {
        Debug.Log(Time.time + "Root Awake");
    }

	// Use this for initialization
	void 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 initialization
	void Start () {
        Debug.Log(Time.time + "Child Start");
    }
	
	// Update is called once per frame
	void Update () {
	
	}
}


运行结果

记一下关于Instantiate时Awake Start的执行_第1张图片






你可能感兴趣的:(unity,3D)