This is going to be hard to explain, but I will try my best.
So what you have is 4 different pictures representing each of the slots, I just gave them a different color, and a pixel size. 1x1 slot 100 x 100. 2x1 slot 200x100 horizontal. 2x1 slot 200x100 vertical. And finally 2x2 200x200 pixels.
These icons are very important to have (not only for testing purpose, but this is also what is obtaining the slots that are icon empty.)
So I have a icon of the chest armor that obtains slot 1,2 and 11, 12. The very chest icon is only in 1. The rest have the red icon 2,11 and 12. (in item structure, 2 different texture2d reference)
Now what you need to do is to is make a lot of uniform grid panels. 1 grid panel for the normal buttons, 1 grid panel for all the 1x1 slots, 2 grid panels for the 2x1h, 2 grud panels for the 2x1v, and finally 4 grid panels for the 4x4.
The reason for this is because we need to know every position a image of different size can be in.
Now that every position has been counted for, its a matter of setting up the logic. And what basicly happens, is that I have an enum in my item structure, that is set to be either one of the sizes. So when the item gets into the inventory, it checks for how many slots it should obtain (the true chest icon only obtains one slot, the red icon obtains the 3 others I need.) So chest icon in 1, the red icon obtains 2,11 and 12.
All the measurement icons are hidden by default. Now, when you put a item in, its a matter of taking the “placed in slot”, get if item is 4slot, if it is 4 slot, set the 4xBox to visible, and replace the texture with the chest icon.
I am really bad at explaining… but I hope it helps you understand how I did this.