更新和更新有什么区别?Unity 中的固定更新? [英] what is the difference between Update & FixedUpdate in Unity?

查看:23
本文介绍了更新和更新有什么区别?Unity 中的固定更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UpdateFixedUpdate 方法有什么区别,什么时候应该使用这些方法?

What is the difference between the Update and FixedUpdate methods, and when should these methods be used?

推荐答案

来自 论坛:

更新每帧运行一次.FixedUpdate 可以运行一次、零次或多次每帧时间,取决于每秒有多少物理帧在时间设置中设置,以及帧率的快慢.

Update runs once per frame. FixedUpdate can run once, zero, or several times per frame, depending on how many physics frames per second are set in the time settings, and how fast/slow the framerate is.

两者区别的详细解释也可以参考duck在同一个论坛给出的回答.

Also refer to the answer given by duck in the same forum for a detailed explanation of the difference between the two.

正是因为这个原因,在申请的时候应该使用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.

而 Update() 可以与物理引擎不一致,要么更快或更慢,取决于图形的负载量在任何给定时间打开渲染引擎,如果用于物理 - 会产生相应不同的物理效果!

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!

这篇关于更新和更新有什么区别?Unity 中的固定更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆