gpt4 book ai didi

unity-game-engine - 何时是更新 Unity 相机的最佳时间?

转载 作者:行者123 更新时间:2023-12-02 15:58:43 25 4
gpt4 key购买 nike

很抱歉问这么简单的问题,但我和我的 friend 正在讨论什么时候是在 Unity3d 游戏中移动相机的最佳时间。
基本上讨论我们是否应该在 UpdateFixedUpdateLateUpdate 上移动它。

我相信LateUpdate将是移动相机的最佳时机,以确保首先完成所有其他计算。但他说你应该在更新期间执行此操作,并将其设置为最后更新。

我可以获得有关其中任何一个的反馈以及为什么其中一个可能比另一个更好?

最佳答案

来自Unity docs :

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.

这使得在语义上听起来 LateUpdate() 和使相机更新成为 Update() 中的最后一个语句之间没有区别。但是,使用 LastUpdate() 强调在帧结束时更新相机具有特殊意义。这使得将来某人不太可能意外添加在相机更新后执行的代码。

关于unity-game-engine - 何时是更新 Unity 相机的最佳时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56961840/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com