unity3d之MonoBehaviour

来源:互联网 发布:js跨域清除cookie 编辑:程序博客网 时间:2024/06/05 20:34

MonoBehaviour是unity3d开发接触最多的基类,常见的可重载的接口有:

Awake: 当一个脚本实例被载入时Awake被调用。

Update:   当MonoBehaviour启用时,其Update在每一帧被调用。

LateUpdate: 当Behaviour启用时,其LateUpdate在每一帧被调用。

FixedUpdate:  当MonoBehaviour启用时,其 FixedUpdate 在每一帧被调用。

OnTriggerEnter: 当Collider(碰撞体)进入trigger(触发器)时调用OnTriggerEnter。

OnTriggerExit:  当Collider(碰撞体)停止触发trigger(触发器)时调用OnTriggerExit。

OnEnable: 当对象变为可用或激活状态时此函数被调用。

OnDisable: 当对象变为不可用或非激活状态时此函数被调用。

OnDestroy: 当MonoBehaviour将被销毁时,这个函数被调用。


具体的调用顺序下图简单明了。



参考 :

http://blog.sina.com.cn/s/blog_5b6cb9500100xgmp.html

http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.html

0 0
原创粉丝点击