首页 > 其他 > 详细

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

时间:2015-07-20 16:34:35      阅读:157      评论:0      收藏:0      [点我收藏+]

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的执行

原文:http://blog.csdn.net/lihuozhiling0101/article/details/46968223

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!