您的位置:首页 > 移动开发 > Unity3D

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

2015-07-20 14:51 316 查看
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 () {

}
}


运行结果

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  unity3d