I have made an inventory system, and I have it to so each item that is picked up is added to an array. Then each item is assigned a widget representing its inventory slot. If the items are identical then it adds to the current stack.
All of that works fine, my problem is I have created an array and filled it with empty slots and I use that array to fill the uniform grid panel as a base inventory. So when an item is added then I replace that array index with the new slot. But for some reason the first array filled with empty slots are not placed correctly into the uniform grid panel. It might be something obvious but I am still very new to this so any tips would be helpful.
Also when new items are added they fill into the correct slots, and the logic used to sort them is the same.
This is how I create the empty array
This is how i sort the array into the grid
This is what it looks like where only one spot has a widget
And this is when i pick up an item and it sorts correctly
Thanks in advance!