Currently, I have an
Inventory that is a
ScriptableObject, which means it's not tied to any specific game object or player character. I just drag it into a
MonoBehaviour if I would like expose the data of the inventory.
I have created an
InventoryUI, which is a
MonoBehaviour attached to a
GameObject in my scene, and I assign the
Inventory SO to it.
InventoryUI contains button
GameObjects with an
InventorySlot script, to which I assign the item each slot is holding.
Everything works fine. When I click on one of the
InventorySlot buttons, I'm able to call item methods, such as
My problem is if the the item is a potion, for example. How can i add health to the player? Of course I could add reference to the player to the slot. But that will reference player repeatedly over 25 slots.