Multi-Scene Work Flow and Script Execution Order

Hey,

My project is setuped using Multiscene work flow like this:

8510534--1133999--upload_2022-10-13_19-1-22.png

QuestMachine’s gameobject locate in Core scene and QuestGiver’s gameobject, which is NPC, is in Level_Farm scene.

And my script execution order setup like this:

8510534--1133972--upload_2022-10-13_18-52-13.png

QuestMachine’s Singleton QuestMachineConfiguration is -80 and should call Awake() before Questmachines’s QuestGiver’s Awake() function.

However, the result is not what I except, QuestGiver’s Awake() is calld first.

Can anyone help me to How do I make it right?

We need more details. This looks to be a complicated setup, possibly you have some other dependencies and lazy initialization, it’s not as simple as this Awake goes before that Awake. What’s with that quest machine configuration wrapper?

Script execution order is more or less a hack that should only be used as a last resort. If you’re using it this heavily, you need to rethink your design.

Remember, self initialisation in Awake, initialisation that requires something else in Start. If you absolutely require things to initialise in a certain order, have an overarching manager that does so in a certain order.

Its just a wapper class to make an addition layer of abstraction.

I am using Script execution order, so it should have a certain order for Awake() to execute.

But not sure why it is not working if I have two scenes load together.

Yes, I am totally agree with you.
But I am using Plugin like QuestMechina, I don’t want to change his code because it might cause some other problem I don’t know.

So I am looking for a way to hack around this…

Scenes only get integrated into the main thread one at a time. Most likely they aren’t loading in the order you expect them to.

1 Like