I am trying to design the item part of my game. My original design was just to treat them as a gameobject and to give every item an item (or some derived) component, and when the item was picked up, such an item would join into the backpack as an invisible gameobject (attached to the backpack UI canvas). Then, when moving the items to the chest or some storages, it also moves the gameobject itself. However, I believe this approach is inconvenient and will be resource-consuming to some extent.
Are there any designs that could optimize the item to be purely scripted data structure? Is it common to do so? I haven't researched too many open-source games, but when I took the game design course, I did so as I described.
I was looking for an approach like:
- be able to link the image of the item (just like the gameobject does).
- minimizing the cost when adding or moving/removing the item from the bag
My most desired outcomes are like the bag in the MonsterHunter.
I just need some ideas to get work done.
amountattribute be bound with the the item or maintained by some inventory? Because I think if I simply change the amount of some item, it will change everything that references to it. \$\endgroup\$