Saving child Actors inside actorBPs

I have a function that gets all actors from map then resizes an arrayand then fills the array with the actors, and its working ok i guess, the problem is that some actors have chilld actors inside of them, and every time i load the game thos child actors that are inside an actor get incremented, resulting in each load to had one of those childs on top of the previous, how can i stop this?

Saving function:

Loading function:

Spawning Objects with load game:

Example of child bp inside an actor bp:

Each time i reload the lamp child gets incremented:

1st reload:

2nd reload:

3rd reload:

Any ideas on how can i stop this from happening?

You can filter child actors:

My Products

2 Likes

This isnt enough because sometimes i need to save actors, i just wanted to respawn the actors every time i load

Actors spawn child actors automatically.

When you get an array of actors with the function GetAllActorsWithInterface, that array includes child actors, too, if they contain the same interface. Then when you respawn the stored actors, the child actors are spawned twice. Once automatically and a second time from your saved array. That’s why I suggested filtering out child actors on save.

Below are two ways to do this:

2 Likes