Here's what I've come up with so far:
On click Object,(Looting it)->Set GlobalVariable=1
-> Destroy Object
And on my inventory layout:
Every tick
GlobalVariable=/=0 ->Spawn Object at Inventory Slot
->Set GlobalVariable=0
The only problem with this is that it populates all my inventory slots with the same item. I need to figure out how to select an empty Inventory slot (instance variable maybe?) and then only create it in that specific empty slot, and not every empty slot.
Thoughts?
Yeah, I would use an instance boolean variable (i.e isEmpty). Then when you're ready to add item to inventory slot, loop through each slot using "For Each" and if isEmpty = true, add item to slot. Then you must use "Stop Loop" so that item is only added at the first empty slot the loop encounters.
For example:
[System]For each Slot
-> [Slot] Is isEmpty -> [System] Create Object at Slot
-> [Slot] Set isEmpty to False
-> [System] Stop loop
Also, other ways you can achieve this:
1) You can use an inventory array that's set to global. Every time you loot in the world layout, you can just update the array. Then on inventory layout load, you can have the layout retrieve values from the inventory array.
2) Use global inventory object but when you want it hidden in the world layout, just offset its position outside the canvas (i.e -100px, -100px).