Unity私有唤醒更新和启动方法如何工作? [英] How do the Unity private awake update and start methods work?
问题描述
Unity如何在后台调用Awake,Update和Start方法?他们对我没有访问修饰符表示它们是私有方法,并且不使用诸如new或override之类的东西,那么Unity框架如何找到调用它们的方法?
How does Unity call the Awake, Update, and Start methods behind the scene? That they have no access modifier to me indicates they are private methods, and they don't use anything like new or override, so how does the Unity framework find the methods to call them?
在一个相关的问题上,是否有不使用虚拟方法的特定原因?
On a related question, is there any particular reason virtual methods were not used?
对于不熟悉Unity脚本的人,这通常是它们的出现方式:
For those unfamiliar with Unity scripts, this is how they generally appear:
public class MyClass : MonoBehaviour{
void Start(){
}
void Awake(){
}
void Update(){
}
}
我不了解的是,当框架看上去像是私有方法时,框架如何为每个脚本查找并自动调用这些方法
What I don't understand is how the framework finds and automatically calls those methods for each script when, by all appearances, they look to just be private methods