Help the noob! Save the GUI!
I have a GUI “panel” that includes a png square overlaid by other png elements. Initially I had built this with GUI and absolute values for placement, allowing me to align the png elements on top of the square.
I changed my build to GUILayout because the panel needs to be movable, BUT now I can’t figure out how to align elements on top of one another using GUILayout.
Here’s my original GUI code:
GUI.Box (Rect (10, 36, 287, 82), "", floorbox);
GUI.Box (Rect (17, 42, 113, 71), "", floor1);
GUI.Label (Rect (70, 70, 20, 20), "1", floorLabelON);
GUI.Button (Rect (138, 42, 61, 71), "", floor2);
GUI.Label (Rect (160, 70, 20, 20), "2", floorLabel);
GUI.Button (Rect (215, 83, 24, 23), "", floor3);
GUI.Label (Rect (223, 87, 20, 20), "3", floorLabel);
GUI.Button (Rect (250, 83, 24, 23), "", floor4);
GUI.Label (Rect (258, 87, 20, 20), "4", floorLabel);
Resulting in:
My GUILayout code:
GUILayout.Box ("", floorbox, GUILayout.Width (287), GUILayout.Height (82));
GUILayout.Box ("", floor1, GUILayout.Width (113), GUILayout.Height (71));
GUILayout.Label ("1", floorLabelON);
GUILayout.Button ("", floor2, GUILayout.Width (61), GUILayout.Height (71));
GUILayout.Label ("2", floorLabel);
GUILayout.Button ("", floor3, GUILayout.Width (24), GUILayout.Height (23));
GUILayout.Label ("3", floorLabel);
GUILayout.Button ("", floor4, GUILayout.Width (24), GUILayout.Height (23));
GUILayout.Label ("4", floorLabel);
Obviously resulting in:
I tried mixing GUI and GUILayout and, while initially the panel looked right, as soon as I turn on another panel this one gets bumped down the screen. The GUI elements don’t get bumped because of the absolute values.
Ideas?