Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: TokyoDan on April 13, 2014, 01:12:34 AM
-
I know that the START event of an FSM is executed whenever the FSM is created in a scene or when a scene is first loaded. But...
Say I load a scene with one GameObject, The GameObject has one script component and one FSM component. Which Start is called first? The Start() function of the script, or the START event of the FSM?
-
Whichever is on the uppermost in the inspector stack.
-
Hi,
Not necessarly, You can not guarantee execution order in Unity. If you move a component up the stack, it won't change it's execution compare to that stack.
bye,
Jean
-
Are there some overrides that might be used to break the top-down flow or something? So far its been reliable for me. The only exception I can think of is if 5 scripts on the bottom have a Start function and 5 scripts on the top only use Update... then the bottom ones will run their Start() first and Update will be run afterwards.
-
Hi,
yes, Unity has a setting to define script execution order, that's where things get tricky and dangerous... Cause the execution order is based on the class, not the stack order... so very prone to hard-to-find bugs :)
Typicall, if the execution order is important, create your own "INIT" or something can call fsm manually, this will a lot more reliable in the end.
bye,
Jean
-
Good to know! =)