Unity3D高级手册04:更新指令(Update Order)

2014-08-16 12:26:36|?次阅读|上传:huigezrx【已有?条评论】发表评论

关键词:Unity3D, 游戏, 虚拟现实|来源:唯设编程网

Unity Manual > Advanced > Update Order


Update Order 更新指令

When you're keeping track of game logic and interactions, animations, camera positions, etc., there are a few different events you can use. The most common is to perform everything inside the Update() function. This is great for most kinds of operations, but there are other options!  


FixedUpdate 固定更新

FixedUpdate() is often called more frequently than Update(). It can be called multiple times per frame, if frame rate is low; and it can be not called between frames at all if frame rate is high. All Physics calculations and updates occur immediately before FixedUpdate(). When applying movement calculations inside FixedUpdate(), you do not need to multiply your values by Time.deltaTime. This is because FixedUpdate() is called on a reliable timer, independent of the frame rate.


Update 更新

Update() is called once per frame. It is used far more commonly than any other option from a user perspective.


LateUpdate 最后更新

LateUpdate() is called once per frame, after Update() has finished. Any calculations that are performed in Update() will have completed when LateUpdate() begins. A common usage for LateUpdate() would be a following third-person camera. If you make your character move and turn inside Update(), you can perform all camera pointing and moving calculations in LateUpdate(). This will ensure that the character has moved completely before the camera tries to point itself at him.  


Coroutine 协同

Coroutines are begun by using StartCoroutine(). Within the Coroutine, any time yield is called, the Coroutine will stop and resume where it left off after LateUpdate() has completed.


发表评论0条 】
Unity3D高级手册04:更新指令(Update Order)