'Begin Play' Execution Order

Hey guys, coming here to share this :slight_smile:

This little plugin I’ve put together adds to our game projects an Actor class that can control in which order Game World will call its Blueprint’s “Begin Play” event.
Very similar to UMG’s render order of widgets; the higher the index the later in the chain the “Ordered Begin Play” function will get called.
It keeps your regular Begin Play function which is called compulsory by the game without any control over execution order, but also adds this new event which you can tell exactly when you want it to get called related to other Blueprint Actors executing Begin Play in the Level.

Earlier, to have a little control over this, I was doing a lot of ‘Delay’ nodes here and there when a Blueprint performs its tasks after some other Blueprints have executed their own Begin Play graphs;
But doing that ultimately becomes very confusing specially if there’s no notes on the Delay function explaining why it is there, often something like this:

To avoid this kind of lazy logic and not complicate things too much with interfaces, references and etc, then I’ve tried this…
Parenting my base Actor classes from AActor to AOrderedActor instead (the Actor class which is created by the OBP Plugin):

After that, my Blueprint now has an “OBP” region in its Details Panel where I can set in which order my new custom Event will be called at;
This makes sure we won’t have to call Delay nodes right after a Begin Play event, ever again:

Now all my actor blueprints can have clear direct control of when will they call their “Ordered Begin Play” event; since the game calls “Begin Play” almost instantly for all Actors in the game and we have no control over its order, I use this custom event as my Begin Play instead:

And that’s all… Simply using “Ordered Begin Play” instead of ‘Begin Play’ event now I’m 100% sure that my Blueprint A will always execute Begin Play first and Blueprint B will always be second then Blueprint C will always be last no matter when each of them have being constructed by the Level,
Although none of them have any references neither know anything about each other. :slight_smile:


[DOWNLOAD GITHUB]](https://github.com/BrUnOXaVIeRLeiTE/OBP_Plugin)

This is pretty cool! I will keep it in mind. Thanks!

This is awesome, I resorted to doing delays before but this looks like THE solution. Thanks for making this free!

Glad to help :slight_smile:

Great job! This should definitely be a default engine feature! :smiley:

Why didn’t you contribute it ?