Beginner Question: How do I store actors in an array then destroy them when the character that spawned then dies

This character spawns a house, I would like the house to be destroyed when he dies. I could simply add and event to each object variable, but I’m hoping to learn something new, adding and storing to array’s is eluding me.

Trying to figure out how I would even start a notification system for spawned objects then checking if the thus object is spawned and limiting over spawning elsewhere.

Multiple characters are being spawned in around the world that are building these houses, would keep them in check.

In things you want to destroy when players dies you bind On Destroyed event delegate from that actor that will die or make your own event dispatcher that triggers when play dies if you got specfic system:

You should have “Bind” nodes when you pull dying actor pin. From binded event you make a code that destroys the object. When dying actor will be destroyed it will call all binded events from delegate, which (if you sish) will destroy objects that have binded that event.

As for a array, considering all objects will be destroyed, you simply clear the array when actor is destroyed, or if array is in dying actor then you can leave it as array will be destroyed with him.

Here you have docs about event dispachers (in C++ they are called Delegates and you may hear that name more):

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/EventDispatcher/index.html

thank you for the answer