C++ Inventory System Question

Hi,

I am trying to make an inventory system and I wanted to check if my approach is alright.

I have set up a base item class that inherits from the actor class, to store basic item information, and I will just make all my specific weapons etc, inherit from this class.

I am then planning to have an inventory class that stores an array of my base item actor class along with static methods to add/remove items to the array etc.

I was then going to simply have an instance of the inventory in the player that I instantiate at the beginning.

I don’t need network support, but I am not sure how to do the inventory class, should I be doing it as an actorcomponent or just a uobject

Any advice would be greatly appreciated

Make something lighter weight for the inventory that can store an asset reference. You only need to be storing instances of the items themselves when they are actually doing stuff in the game. For example, the way I do it is I have a Data Table that stores all item relevant data including a blueprint reference and then I store the string id of the value in the table in my inventory. When I want to equip the item or get some other data I query the data table and grab it.

If the data table is too slow, you can instead just make a struct that stores the asset path of the blueprint and store the structs in some faster to access data structure.