Update vs FixedUpdate
1.相同点
-
都是要在每一帧内调用
2.不同点
-
update每次调用的时间间隔不一样,fixedupdate每次调用的时间间隔都一样。
-
update的调用适合如下的情况:对于非物理作用的物体的控制,对input的检测,还有simple timer (定时 displaying a timer)。fixedupdate的调整物理(或者刚体的)物体。
下面放上两张图:
、

FixedUpdate 的时间间隔在Unity EDITOR 的设置 Edit-->Project setting-->Time
How to boost Mobile FPS by adjusting Fixdeupdate interval ?
(摘抄)
Update Performance
What this ( theoretically ) means is:
FixedUpdate @ 0.04 (25 TPS) vs 30 FPS Update = 16.7% boost!
FixedUpdate @ 0.05 (20 TPS) vs 30 FPS Update = 33.3% boost!
FixedUpdate @ 0.04 (25 TPS) vs 60 FPS Update = 58% boost!
FixedUpdate @ 0.05 (20 TPS) vs 60 FPS Update = 66.7% boost!
* TPS = Times per second, FPS = Frames Per Second
Update gets called once every frame that is rendered.
FixedUpdate gets called at a regular time interval, no matter what。
Rule of thumb, purely visual stuff should stay in Update, since it's only going to change once every frame. Things involving physics, collision, detection of motion, should be in FixedUpdate.
It's for this reason that FixedUpdate should be used when applying forces, torques, or other physics-related functions - because you know it will be executed exactly in sync with the physics engine itself.
Whereas Update() can vary out of step with the physics engine, either faster or slower, depending on how much of a load the graphics are putting on the rendering engine at any given time, which - if used for physics - would give correspondingly variant physical effects!
一下内容摘自http://forum.unity3d.com/threads/physics-help-needed.173233/



浙公网安备 33010602011771号