Save actor's destroyed(picked) state between levels

A good practice is to create empty game actors and add them to your level to hold data. That way you can call that data from anywhere in game and it isn’t all in one blueprint. Good code is simple and layered like a machine with many parts(or functions) rather than one part with too many functions inside of it. This is the reason I’m using this particular method.

Firstly, you need to create a new blueprint actor named: “Items_Destroyed”
This actor will not have a mesh and you wont see it in game, but it will hold data to save and call from in the level blueprint.

Next open that blueprint and create a new variable of type Actor (reference) and make it an array. Name it “Items_Destroyed”. Exit out of the Blueprint.

Add the Items_destroyed ACTOR to the level by dragging it into the viewport.
Next, in your pickup function (with the line trace), you need to add some code.

After that you need to add code to your Save Game Blueprint (if you’ve made one, if not, right click in the content browser and create a blueprint, search for save game, and select it to create a save game blueprint).

In the save game blueprint (Mine is called SAVE) create a variable of type Actor (reference) and make it an array. Name it Destroyed_Actors (I’ve chosen to name it differently than the Items_Destroyed variable that we made before because it helps to keep them straight when saving and loading). Exit out of the blueprint.

Next you will need to add code to your game save function.

And add code to your load function.