Trying to understand the execution order with more than one script (some questions)
We've the lifecycle chart: https://docs.unity3d.com/Manual/ExecutionOrder.html and also the execution order: https://docs.unity3d.com/Manual/class-MonoManager.html
For example we've a script PlayerController
(with execution order 1) and another script CameraController
(with execution order 2).
We have in PlayerController
:
FixedUpdate
a function to update the movement.Update
a function to get the axis controller.
And we have in CameraController
:
LateUpdate
a function to follow the player movement.
Q1: In the first frame, the player won't move because Update
is called after FixedUpdate
, but as FixedUpdate
can loop more than one time per frame, in what moment FixedUpdate
will stop to loop? Just after Update
, just before Rendering
cycle...?
Q2: Are the callbacks executed in order? For example, 1- Start
of PlayerController
, then Start
of CameraController
, then FixedUpdate
of PlayerController
, then FixedUpdate
of CameraController
... and so on.
Q3. If the above answer is yes... In the first frame, if we had in PlayerController
a long processing task, it would block the execution of the other scripts?
With that questions I try to understand also if LateUpdate
always will be called after the Update
of PlayerController
, or if has another order.
Your answer
Follow this Question
Related Questions
Basic Enemy follow script for Unity five, desperately needed! 0 Answers
error CS1525: Unexpected symbol `(', expecting `)', `,', `;', `[', or `=' 1 Answer
How do I make a loop in a C# script? 1 Answer
Accessing script from another object 1 Answer
How to slowly rotate an object only once using scripting? 1 Answer