Best way to store in a save game a picked up item?

I’m trying to save and load inventory data, and the way I’m trying to do it is by saving an actor reference of whatever items I pick up into an array, and storing it in a save game.

problem is that when I pick up items, I destroy the actors so they are removed from the world, so when the code tries to populate the inventory using info stored in that array, I get this error, probably cuz the actor was destroyed.

do I need to extract actor info to store into the save game (ID, icon image, stack number, etc) or is there a simpler way to do this?

Actor name is not a good way to do things.

If you’re destroying a recreating things, obviously it won’t be the same.

If we’re talking about blueprints, the can have an ID ( int ), and can monitor the save game situation themselves. Recreating or destroying themselves as necessary.

If it’s just static mesh actors, you’ll need some sort of ‘actor manager’ which controls their location and existence. It might be good if they all had an actor tag, so the system knows to monitor them.

1 Like

In a struct representing item data, ideally. Yes. Arrays of structs. Oftentimes nested.

or is there a simpler way to do this

Marketplace plugin$.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.