How to handle the Begin Play events for actors added in the editor?

Hi, I have a few actor blueprints that I have added to the level in the editor. All of them have executable code running as part of Event Begin Play. And in one case, the actor is referencing another one of these actors. It is running smoothly as this point, but I don’t think what I’m doing is safe practice.

What if the referenced actor [Let’s call it Actor B] has not finished initializing in ? So should I fire off that begin play functionality as part of a custom event that is called when the first actor [Actor A] goes through it’s begin play event to the completion?

You could put a half second delay in.

That would make sure they all exist before anything happens.

Yes I suppose that should work in some cases, but it still doesn’t guarantee that the other actors have finished storing a reference that I can use. The begin play code would still start running for all actors at the same .

Do you know if there’s any standard workflow that’s used in the industry to handle stuff like this?

All depends on how you are referencing them.

I got the answer from the Unreal forums. It seems it’s better to spawn them as part of another script like level blueprint or game mode rather than just putting them in the editor. Here’s the link to the forum post:

[How to handle the Begin Play events for actors added in the editor? - Blueprint - Epic Developer Community Forums

How to handle the Begin Play events for actors added in the editor? - Blueprint - Epic Developer Community Forums

the half second delay suggestion is poison. can someone remove it?

its terrible leaving it here in a place that’s meant for answers…