What is the general use of Awake(), Start(), Update(), FixedUpdate(), LateUpdate()?

这个总结的比较好,这是最佳答案,目前只能看start和update,其他的还没有接触到,留着以后复习看吧。

原文链接地址:http://answers.unity3d.com/questions/10189/what-is-the-general-use-of-awake-start-update-fixe.html

This really is something that is well covered in the scripting reference, so I'll just link to the descriptions:

Quoting from the docs:

The difference between Awake and Start is that Start is only called if the script instance is enabled. This allows you to delay any initialization code, until it is really needed. Awake is always called before any Start functions. This allows you to order initialization of scripts.

LateUpdate is called after all Update functions have been called. This is useful to order script execution. For example a follow camera should always be implemented in LateUpdate because it tracks objects that might have moved inside Update.

Also note that LateUpdate is called after animations are applied - this means you can implement procedural animation in LateUpdate which modifies the pose sampled by the animation system.

FixedUpdate is called every fixed framerate frame, if the MonoBehaviour is enabled. FixedUpdate should be used instead of Update when dealing with Rigidbody. For example when adding a force to a rigidbody, you have to apply the force every fixed frame inside FixedUpdate instead of every frame inside Update.

I hope that helps. You can read more about overridable functions on the scripting reference page forMonoBehaviour.

You can also read here about the Update Order.

Update Order link has changed since the time of this writing. It is now here(http://docs.unity3d.com/Manual/ExecutionOrder.html) and includes the initialization and render steps as well.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值