Hey everyone! Hope all is well.
I wanted to reach out to see if anyone is familiar with what I’m considering for my project. Recently, I’ve been planning to create an inventory system, and through most of my research, I found that the best solution for me would be to use Data Assets along with either Structs or UObjects.
For my game, I’m planning to have several item types and classes, including, but not limited to, base items, consumables, weapons, equipment, etc.
My question is: When it comes to saving data that changes during runtime such as ammo, attachments, durability, or quantity what do you think is the better approach: UObjects or Structs?
I’ve considered using Structs, but I’m concerned that having all the information (such as weapon details) in a Struct might be wasteful since I will have different types of items with unique data for themselves, especially since a consumable wouldn’t need this data, and a weapon class wouldn’t need the consumable details.
So, am I missing something here? Is it possible to use inheritance with UStructs? For example, could I create a base struct like FItemBase
, and then derive other structs from it, such as FWeaponBase
, which I could use in my inventory component’s array of item variables?
Alternatively, should I just use UObjects to store and manage this data?
Thanks in advance for your help!