Here is the problem I have my camera controls in one script and my player movement in another both are in case statements while im in first person view my character hitches and jumps infront of the camera I understand this is happening because I am running both each frame at the same time and the camera is jumping ahead of my character. is there a way to get the movement in a lateUpdate?
You’re too confusing! But you can simply rename your current Update
“function” (actually it’s a method) to LateUpdate
.
If you want just few things in LateUpdate
, move them there.
If you need variables to be accessed from one another, set them in the class and be careful they won’t be garbage collected the same way.
It’s really not that complicated, unless you’re completely understating your question.
edit:
If LateUpdate
is not an option and you need 2 updates in 2 different scripts to always run one after the other in sequence, every frame, just set the script execution order. That’s precisely what it was made for, respecting each event primary order.
If you just think you couldn’t use IEnumerator
, you actually can (see here).
Finally, and maybe the solution for you, you could also roll your own update manager. Simply create a script with an Update
which will call methods in any other script in the order you need.
PS: See how many “if’s” are there in here? Everyone trying to guess what the heck you’re asking.