Is there a ways to check if actors have spawned in world, spawned from begin play in game mode

Hi, Im making a turn based battle system much like the final fantasy series, and i need to do some things after the actors have been spawned into the world via blueprint. A quick over view of the current logic:

Game Instance loads all party information and is loaded into the Game mode, including required BP classes to spawn, then:

GameMode: Begin Play → Spawns players from info given → Sets up order based on speed stat → Starts first player turn.

My problem: The actors arent actually spawned into the world visibly untill the end of the begin play in game mode. If i need to say play a sequence or create some ui etc, the players are not “in the world” yet even though they have been created as objects in memory via BP.

My question: Is there a way to find or wait for the actors to be placed into the world before i start the players turn? I am fairly new to UE4 and this could be the wrong approach, so any advice would be appriciated. I do need to spawn these actors in on the level as you could have varied different characters within a party so nothing is ‘static’ and can be placed.

p.s i would also welcome any solution recommendations via c++ if this cannot be completed via BP

Thanks

You can always use event dispatchers to ensure things are executed in the correct order. Just have the game instance call the game mode to execute its stuff through a binding. This way you ensure the game instance has completed its execution path before the game mode starts doing its thing. If you need help with setting up event dispatchers check out video #26 in the link below.

I’m saying the event dispatcher allows you to control the flow of execution no matter which blueprint you put it in. It’s just a way to organize events across blueprints. Where you create it depends on your particular setup.

Hi thanks for the tip I will give it a try, I tried to use an event dispatcher on the game mode and didn’t consider using the game instance. Most of my spawn code is in the game mode though so you recommend moving that to the instance ?

a simple method I use is the is valid node for that actor, and if it isnt valid i run a delay for .2 seconds , can be any value, and then back into the is valid node… i know at some point that actor will be valid, just do not know when, and so this makes it foolproof…

it is considered hacky, but for something like a onetime event for starting the game it’ll be fine… a better way is how nebula said to use event dispatchers or even just normal events, have the necessary actors “register” themselves by calling events on the game mode, and on every “call or event” run the is valid for all the necessary actors, eventually they will all be valid… theres a lot of ways of doing it, so now im sure you have some ideas

Event dispatcher still was on the begin game thread so my characters werent physically in the world yet to call upon, but it was a real good idea! However This did make me look at my bps and i had a lot of jumping back and forth between the game mode and levelblueprint, popping this all in one place seems to have done the trick! Many Thanks for the advice, it still led me to the answer! like the channel :slight_smile:

Would the actor still be valid if it is loaded in memory BUT not spawned into the world visibly yet though?