Download

Can you control the order in which the Engine executes Begin Play functions?

Hey there. I’m a student of Unreal, and in the game I’m making, one of my characters has to send a reference of itself to all the other characters in the game right at the very beginning. However, sometimes, the BeginPlay of the main character doesn’t execute before the BeginPlays of the other characters, so they act based on an empty instance.

This is why I want to ensure that my main character always executes BeginPlay first. Is there any way I can do that?

In short no, things get even worse in packaged games too…
So its up to you to have a polling loop to check for key vars…

I usually set up an initialization workflow in all of my projects, in the begin play of the game mode. It is tasked with initializing/spawning all the important actors in a defined order. This way, you do not have to worry about the execution order getting messed up.