Saving spawned actors between levels

So I’m inching my way along in creating system that saves states (isDead, etc) for actors in a level. I was initially trying to only save actors that have been killed. So, I’m saving an array of actors of type BP_Enemy that only includes the dead actors. On loading a level, I get all the actors of type BP_Enemy and then compare them to my array contained dead actors. I was expecting to be able to do an “Equals” between them and figure out which actor is dead and destroy that actor but the equals never returns true. I’m probably missing something here.

The name of the actors in the level can’t be relied upon, that’s the problem.

You can give them all an ID, just an int, and in the save game have an array of ints that died.

When you restart the level, you just need to kill all actors with the ID in the array.

I think I follow. So I could create a variable of type int, and on each instance in the world have it be unique. Is there a way to automate that? Like generate a unique id automatically?

I don’t know how you have it set up, but you can number them as you spawn them, or use a blueprint to number them if you have placed them in the level.