Download

Alternate of using 'Delay' to handle Begin Play event in multiple bps

I have Begin Play event in both Level bp and Pawn bp. It seems like pawn bp occurs first and then level bp. Its a problem for me because I need to pass reference of an actor in the scene to my NewPawn (DefaultPawn) Blueprint.

What I have done is I created a editable variable in NewPawn bp called “Look At Target” of type StaticMeshActor and initializing this variable from my Level Blueprint in the Begin Play event and I need to perform some action in the Pawn bp Begin Play event too. since the event in pawn bp is triggering first I am getting a none reference which is causing errors.

I have add a Delay` node in Pawn bp so the level bp does its job and it comes here later and everything works perfect. I feel delay might not be efficient way of handling all kinds of scenarios but is there an alternate?

Hi, On your Pawn, you could use a custom event and in your Level BP, call that event after its done its thing you need it to do.

something you need to know, Begin Play happens every time when a BP instance is created. So if your player/pawn will die/destroyed and then respawn, make sure your logic is proper.

I’m guessing it’s a no, but would this logic apply to teleporting the pawn/player around the map?

beginplay only happen once per actor lifetime, unless you destroy an actor and spawn a new one, then beginplay of the new actor gets called again.
for level, it won’t fire unless you reload the map, which you don’t want to do as everything will be re-initialized.
teleport usually just use custom events or RPCs if you are aiming for multiplayer.