Unity3d脚本生命周期

如图:

测试脚本:

using UnityEngine;

public class Test2 : MonoBehaviour {

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

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

    // Use this for initialization
    void Start ()
    {
        Debug.Log("Start");
    }
    
    // Update is called once per frame
    void Update ()
    {
        Debug.Log("Update");
    }

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

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

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

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

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

 

posted @ 2017-05-06 10:11  观海云不远  阅读(235)  评论(0编辑  收藏  举报