Unity noob here.
In my game I have code in my OnGUI () that draws Rects on the screen for inventory slots on the HUD. This works fine, they sit and scroll with screen as they should.
Rect slotRect = new Rect(xpos, Ypos, 30, 30);
GUI.Box(slotRect, "", skin.GetStyle("Slot"));
However when I maximize the screen, the slots no longer sit where they should, instead they keep their position and size so end up floating in the middle of the play area.
How can I solve this so that they always position and size relative to the screen?