Hello, I am trying to implement an inventory system in a game I am making and am unsure what the best practices are for doing so. Most tutorials and examples I have seen have described structs as generally being the best solution. Currently within my struct definition I have an int ID, FText Name, FText Description, and AActor* Actor. My goal for the items in the game is to have some items that can be held in hand, picked up, and put down as well as have some items that can be stacked. I can think of a few ways to implement this however I don’t know what the cleanest is. Should I have different structs for items that are stackable and those that are not? Should I have different structs for holdable items?
It really depends on your game’s requirements. I would suggest taking a look at the Lyra sample project as it has an inventory system. Another example that isn’t as large as the lyra project is described at this link: https://jambax.co.uk/replicating-uobjects/
Thank you for your help I was able to find some answers in this post.
I covered the Lyra Inventory/Item prototype here. Even if you’ve found an answer, it may be worth reading this to see how Epic did it in Lyra in case you get some ideas for your own system: