UnityAPI--事件函数(生命周期函数)

本文详细介绍了Unity引擎中MonoBehaviour脚本的生命周期方法,包括Reset、Awake、OnEnable、Start、FixedUpdate、Update、LateUpdate等方法的调用顺序及应用场景。

从上到下依次先后顺序执行,
注意:Reset()方法是在挂载脚本的时候调用,FixedUpdate()只和次数有关和帧数和时间无关。

    void Reset()
    {
        Debug.Log("Reset");
    }
    void Awake()
    {
        Debug.Log("Awake");
    }
    void OnEnable()
    {
        Debug.Log("Enable");
    }
    void OnApplicationPause ()
    {
        Debug.Log ("OnApplicationPause");
    }

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

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

    // Update is called once per frame
    void Update()
    {
        Debug.Log("Update");
    }
    void LateUpdate()
    {
        Debug.Log("LateUpdate");
    }
    void OnDisable()
    {
        Debug.Log("Disable");
    }

    void OnApplicatoinQuit()
    {
        Debug.Log("OnApplicationQuit");
    }
    void OnDestroy()
    {
        Debug.Log("OnDestroy");
    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值