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

Unity初始化函数以及退出函数的执行顺序

2017-05-02 14:24 375 查看
public class HanShuCeShi : MonoBehaviour {
void Awake()
{
Debug.Log("Awake");
}

// Use this for initialization
void Start () {
Debug.Log("Start");
}

// Update is called once per frame
void Update () {

}

void OnEnable()
{
Debug.Log("OnEnable");
}

void OnDisable()
{
Debug.Log("OnDisable");
}

void OnDestroy()
{
Debug.Log("OnDestroy");
}

void OnApplicationPause(bool pause)
{
Debug.Log("OnApplicationPause : pause = " + pause);
}

void OnApplicationQuit()
{
Debug.Log("OnApplicationQuit");
}
}

打印结果:

红色  启动Unity       

 蓝色 Unity失去焦点 获得焦点 

绿色 停止Unity

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