Award –> OnEnable à 返回调用函数 à Star à 下一帧à Update à OnDisable -> OnDestory
测试:
有一个prefab 叫mono,其上帮有一个脚本 MonoTest。momo为Active,且MonoTest为enabled。现用GameObject.Instantiate来实例化此prefab。测试脚本中Awake,Start,OnEnable,Update等的调用顺序,以及调用帧。
测试代码:
using UnityEngine;
using System.Collections;
public class MonoTest: MonoBehaviour {
void Awake()
{
print("Awake");
printFrameCount();
}
void Start()
{
print("Start");
printFrameCount();
}
void OnEnable()
{
print("OnEnable");
printFrameCount();
}
void OnDisable()
{
print("OnDisable");
printFrameCount();
}
void OnDestroy()
{
print("OnDestroy");
printFrameCount();
}
void Update()