I’ve been playing around with an inventory system and hit a wall. I have a list which is type item, and class inheritance for types if items. I wanted to store all game objects in the list, but I realized I’ve been destroying them when picking them up, which ruins the reference. I thought maybe they could be hidden, or disabled, but that worried me when I contemplated going to other scenes, because the same objects wouldn’t be there. I know in other languages an object is just pure data. Then you can store, say a php object, in an array, and access it whenever. Unity seems to be a little different.
What should I do here? Can’t I just store the pure class information in the List?
Edit: I just did a test and instantiated a new class, and set all the values from the game object before destroying the object. After storing the newly instantiated class object, that I assumed would be all the values, I’m still getting null reference error.