the reason to Use a Unique Id system has to do with we can now hold those items somewhere else, and probably as something lighter weight. instead of keeping track of say a full Blueprint Instance with a bunch of unique functions, meshes, animations… we instead hold the UniqueID and then we can get back the exact thing.
the other reason to use a UniqueID system if not for simplifying memory at the moment we can hold the items in a different structure, like an Array<InventoryItem>
then we are just playing with arrays. a UniqueID is not nessesary, but it can help for referencing because instead of referencing a full item to see what it is we can just look at the UniqueID and maybe a couple other small things because full Object Compares get expensive fast.
in your situation could I maybe suggest instead of the Slot being the item, instead the Slot holds an index of say Array<InventoryItem>
and your “Backpack” just so happens to be a wrapper on that Array<InventoryItem>
. now bring up 2 Backpacks is just pulling up 2 Arrays and if the Grid-Slot is an Array Index you can just MoveItemByIndex(int ItemIndex, int TargetIndex)
or however you want to formulate that.
then to remove an item from being equipped you would remove from the equipped slot and put it back into the Array (if it ever left the Array that is)