I want to make a game where I can hold tools in my hand and inventory. Obviously I want to pass them between levels and maybe even game sessions. Question is, how would I do that?
With simple variables like amount of money or HP, all I do is store a variable in the Game Instance. But what about, for example, a tool that has more data, like the class type, durability, maybe value? Even worse, whole array of them?
The way I use that in game is, there's an actor representing the tool. But even if I store array of those in the game instance, the actors get destroyed while changing level and the array just points empty memory. I could just spawn new ones by using the class type - but that is not enough for me.
My idea is to create something... maybe a struct, that would hold the information and then recreate the inventory item actors according to the data in the struct.
My questions: What are other ways to do it? and Is there something fundamentally wrong with the way I'm storing the items in my inventory now?