I ask this question to myself quite often…
I used the structure to store all the items, but when it came to different item types it became a problem, as I need to store every item type variable in one structure. As a result, I got a weapon with consumables stats and vice versa.
Second version of my inventory was based on references.
- I created class based on “Object” (The most basic class in UE which only stores data) and put all item’s data in it. Then by creating child classes I created items to pick up.
Also I created Actor classes to put them in the world. Each actor class consist class of the item. When actor is spawned, it builds an object based on item class.
When the actor is traced, item reference is put to an array.
It makes managing individual items ridiculously easy.
However it becomes a huge pain in the back when comes to making it work in multiplayer and saving inventory…