unity 组件开发常用生命周期说明
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class move : MonoBehaviour
{
// Start is called before the first frame update
// 生命周期
// 最早调用
private void Awake()
{
Debug.Log("Awake");
}
// 激活组件后调用
private void OnEnable()
{
Debug.Log("OnEnable");
}
// 在所有 Update 之前调用一次(只一次)
void Start()
{
Debug.Log("Start");
}
// Update is called once per frame
// 每帧调用一次
void Update()
{
// Debug.Log("Update");
}
// 每次Update执行之后执行一次
void LaterUpdate()
{
// Debug.Log("Update");
}
// 每隔 固定的时间 执行一次
private void FixedUpdate()
{
}
// 关闭组件后调用
private void OnDisable()
{
}
// 被销毁时调用的事件
private void OnDestroy()
{
}
}