Sorry to ask such as simple question, but my friend and I were discussing when is the best time to move the camera in a Unity3d game.
Basically discussing whether we should move it on an Update
, FixedUpdate
, or LateUpdate
.
I believe LateUpdate
would be the best time to move the camera to ensure that all other calculations are done first. But he says you should do it during update and just set it to be the last thing that updates.
Can I get some feedback on either of these and why one may be better than the other?
From the 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.
This makes it sound like semantically there is no difference between LateUpdate()
and making the camera update be the last statement in Update()
. However, using LastUpdate()
emphasizes that there is special significance to having the camera be updated at the end of the frame. This makes it less likely that someone in the future might accidentally add code later that would get executed after the camera update.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With