Add event to a child actor being destroyed
I'm trying to make a system where if a (spawned) child actor is destroyed, it will repeat the script that spawned it. I've figured out how to spawn the first child actor, but have no idea how to set a variable or add an event to when that child actor is destroyed.
Help would be greatly appreciated!
Pictures here: https://imgur.com/a/PgAeo
asked Dec 01 '17 at 02:37 PM in Blueprint Scripting
Right click: Type Bind Event to OnDestroyed and create an event to be called when the actor is destroyed. Connect the in pin from the Bind Event node on the BeginPlay event, to create the listener as soon as possible.
answered Dec 01 '17 at 10:59 PM
I stumbled upon this question while trying to create a spawner class that is able to spawn children of an arbitrary blueprint class.
The way I went about it was to create an event in the parent, named
Then in each child class I hardcode the overriden
This approach seems acceptable for a small number of classes but gets annoying / messy quickly for an arbitrary number of them. Slightly messier if you have multiple classes of potential parents. Maybe it becomes more manageable if pulled from a blueprint library.
I wonder if it can be done cleanly by creating a custom component that is created and inserted in the child during runtime.
answered Apr 24 '19 at 04:30 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here