I'm having a really weird issue: I have an inventory system with slots instantiated at run-time via a slot/button prefab.
My Anchor is set to topleft. Everything works as expected when I run in maximized mode. However, if I change the inventory position OR run in normal non-maximized view, some if not all the buttons will not detect input at all! Nothing will happen if I hover over them, etc. Although I checked to see if something went wrong with the slots after I moved the bag/inventory, everything is still set right, the colliders, etc. See the images in the attachment.
I created a simple button and changed its anchor, played around with its position in both normal and maximized views, it worked OK, which means it must be a problem with my slot prefab... However, it seems like it's a normal button, see the inspector image I provided as well :/
Please help, I'm really puzzled here... Thanks.
EDIT: If you want to see the code for instantiating:
public void AddSlot(int i, int j)
{
GameObject slotObj = NGUITools.AddChild(gameObject, slotTemplate);
Transform slotTrans = slotObj.transform;
float x = SPACE_BETWEEN_SLOTS * (j + 1) + j * slotSize;
float y = -SPACE_BETWEEN_SLOTS * (i + 1) - i * slotSize - headerPadding;
slotTrans
.localPosition = new Vector3
(x, y, 0f
); var slot = slotObj.GetComponent<Slot>();
slot
.Init(new Index2D
(i, j
),
new Dimension2D
(x, y
), slotSize
); slots[i].Add(slot);
}