Hello!, I recently started to work on a inventory system but im unsure of which method to use for the actual creation and storing of items…
On my initial iteration i just had an array of “Item” Actors but since the items needed to be spawned in the world to be able to access any of their properties and Were also garbage collected every 60 seconds i ditched this method
Now im trying to decide if i should use either a Array of a Struct of items or an Array of item classes
Struct of Items
If i went ahead and used a struct to handle all my items i would be able to easly access all of their properties without the need of spawning/despawning and no more troubles with GC either…
The only problem i can see is that if i want to display the items in the world id need to make an Actor class with a struct that holds all the properties of the Item itself
Array of Classes
On the other hand instead of having a array of Actors in the player inventory, i could use a array of item classes instead , Spawn its blueprinted class when i need to access any of its members ( Item Name, Weight etc ) and de-spawn it when not needed
Again the only problem i can see is that for someting like Displaying the items in a inventory screen id need to spawn all the items and loop trough them since im nearly sure you cant access a Actor class properties without spawning it first?
So tl:dr; I Would really appreciate some advice on which method would work best … Thanks!