Download

Event begin play not working

Hi there!

I am trying to enable input on a class blueprint, by the typical method using Event Begin Play. However, I don’t want the class to exist before I press a button to spawn it in the first place. My problem is, if I don’t have one in the scene to begin with, Event Begin Play doesn’t fire, so input isn’t enabled.

Is there a workaround/something I’m missing?

Hello Braxzy, I addressed this in the thread I replied to earlier, but you can check this reference for an actors lifecycle:

What your are looking for is the side of the graph with the lighter blue coloring, as you are spawning in actors, not loading them with the map on startup.

This graph is for the C++ side of things, but its pretty much the same calls in blueprints. So, you can try OnActorSpawned which is called after the components initialize, but before beginplay.

You should be able to get most of these events in your blueprint.

Hey Shigan, thanks again for the response. There doesn’t seem to be an OnActorSpawned event in blueprints? I don’t know C++, is it specific to coding?

I was digging in there myself just now trying to find the correct calls for you, but it looks like Blueprint doesnt have the OnActorSpawned exposed. And a more broad dig into the code shows that postinitializecomponents is the function that needs overridden in your actor class. But the blueprint doesnt have access to this. You could expose it in the code pretty easily to then extend by blueprints, but it would require going into the code, and then your actors blueprints would have to be based off your new class.