So, I’m making an Inventory System and I need to have items derived from a base class BaseItem and replace variables from this base class in each child.
I have my BaseItem class that holds basic information that all items should have, this basic information is static so it can be accessed without an instance.
- Name FString]
- Description FString]
- Weight float]
- Cost int32]
So the problem appears when I need to replace/override this information in a derived class, I can’t override a static variable from the parent class.
I only need this information once for each derived class, that’s why I need it to be static. The inventory also should be able to reach thousands of items and have no problem at all.
The actual inventory is an array of InventoryItem Struct which contains:
- Item BaseItem Class]
- Amount int32]
- The inventory has to be Serializable so it can be saved
- There will be lots of items and all derived from the base item
- The item information should be easily accessible and fast. (fast in the case of having thousands of different items)
How could I workaround this issue?
Or in what other way could I approach this problem?
Thank You in Advance!