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 () { } }
执行结果