Hi
So I’m making an inventory system, where items are using DataAssets for variables such as name, weight and amount etc.
I stumbled upon a slight issue which surprised me, whenever I change a variable in the DataAsset during runtime the variable is saved on that DataAsset in the editor.
This seems great if you want to store changes to items, but I’m using it to keep track of how many of an item I have and the weight of them. If this is intentional, i’ll defintively keep this method in mind of changing actor variables permanently during runtime lol…
Basically, when adding an item to the inventory. It stores the DataAsset reference in an InventoryArray. And if we already have an item of the same “ItemID” instead of adding another reference, it updates the existing item reference’s count and weight, so to “stack” them.
The problem is that every time i update the “count”, it updates for all items on the ground too, so next time i pickup something, it’s 2+2 isntead of 1+1, next time 4+4 etc.
So I’m definitively using these wrong… So what is the appropriate way to update the inventory stack of items storing only DataAssets?
I guess I could just add each reference to the array and then “stack” them in UI later, but seems like a bit of a hazzle…no?
Thanks!