Why does packaging change the order of creations of GameMode and other widgets?

After playing with a packaged project, I noticed that my Settings widget (who calls a GameMode function to fill mouse-related settings from savegame) got a -1 value. This value is returned when GameInstance is null. As far as I know, GameInstance is the first thing that is created by the Engine and it is where my SaveGame-related functions are.
Basically (in pills) MainMenu widget creates a Settings widget which calls GameMode->GetMouseSensitivity, which calls a GameInstance->LoadGame.
This works perfectly fine in the editor as you can see from this log:

1)Creating GameMode
2)Creating MainMenu widget and sub widgets including Settings
3)Settings widget calls GameMode->GetMouseSensitivity, which calls a GameInstance->LoadGame
4)Settings widget applies settings

But this is what happens after playing the executable version:

1)Creating MainMenu widget and sub widgets including Settings
2)Settings widget calls GameMode(which has not been created yet (??)) ->GetMouseSensitivity but fails because GameMode doesn’t exist yet
3)Therefore returns -1
4)GameMode is created
5)GameMode calls CreateNewGame function in GameInstance

So, does that means that the order of creation of widgets, game modes etc. is not consistent between editor and executable versions? What should I do to avoid that?

I think you’ll find you can’t actually rely on the order things are created, even in PIE. It might work reliably in one order, but if you make various changes ( especially the order you compile things ), the load order could change.

Often people end up putting a delay on begin play ( or the equivalent ), to make sure everything’s ready, but it’s probably better to have a test to discover if what you’re expecting to be there, is there.

There is also, this: