Execution script order

Hello,

I’ve already check the unity manual and found the execution order that I need (FixedUpdate > OnTrigger/Collision > … >Update).
But I still have 2 questions.

FixedUpdate and OnTrigger/OnCollision are parts of physics engine.
If I write on console a “fixedupdate” message at the beginning of FixedUpdate()
and a “stayintrigger” at the beginning of a OnTriggerStay2D()
the console reports

fixedupdate
stayintrigger
stayintrigger

fixedupdate
stayintrigger
stayintrigger

there is 2 collisions messages for 1 fixedUpdate.
Is it normal ? Is it always the same ? I thought (read on manual) that FixedUpdate and collisions worked one after the other.

Other question … If I call a function from a collision, do I have to wait for return before FixedUpdate() start again ?

Thx for your help :slight_smile:

1 Answer

1

Seems that I had 2 colliders which generates the OnTriggerStay2D() !
My fault :slight_smile:

any idea for the second question ?
If I call a function from a collision (or another part of the project), do I have to wait for function “return” before FixedUpdate() start again ?

thx

I made traces, and it seems that functions need to returns before the rest of the code continues. I thought that unity parallelized some tasks, but it doesn't.