Hi,
I am working on an App that contains a GUI with 6 buttons. One in each corner and one in the top middle, one in the bottom middle. When I click a button on the bottom of the screen, I get the initial menu drawn properly. When I click on a button in that menu, the GUI is reset and then a new sub-menu should be drawn in the exact same space as the previous menu. The second menu is not being drawn.
This code draws the initial menu and works just fine…
if (drawBottomRightMenu) {
Debug.Log ("brmenu: x=" + (Screen.width - (maxMenuWidth + 10)) + ", y=" + (Screen.height - (maxMenuItemHeight*3+32)) + ", width=" + maxMenuWidth + ", height=" + (maxMenuItemHeight*3));
// Make a background box
GUI.Box (Rect(Screen.width - (maxMenuWidth + 10),Screen.height - (maxMenuItemHeight*3+32),maxMenuWidth,maxMenuItemHeight*3),"");
The Debug.Log prints “brmnu: x=350, y=243, width=120, height=45”
The code for the sub-menu is…
if (drawBGSelection) {
Debug.Log ("bgselection: x=" + (Screen.width - (maxMenuWidth + 10)) + ", y=" + (Screen.height - (maxMenuItemHeight*3+32)) + ", width=" + maxMenuWidth + ", height=" + (maxMenuItemHeight*3));
// Make a background box
GUI.Box (Rect(Screen.width - (maxMenuWidth + 10),Screen.height - (maxMenuItemHeight*3+32),maxMenuWidth,maxMenuItemHeight*3),"");
The Debug.Log prints “bgselection: x=350, y=243, width=120, height=45”, but the box and subsequent buttons do not appear on the screen. I tested for screen width, and it showed as 480 for both functions. I tried with the bottom left and was unable to display a menu there either, however the menus and sub-menus at the top of the screen display just fine. The x and y positions is hard-coded for the top left, and x is dynamic for the top-middle and top-right menus.
I have tried saving the GUI.depth, temporarily adding 50 to it for the sub-menu and then changing it back to no avail. I tried hard-coding the menu to the same values used for the top-left menu and sub-menu that works fine, but that didn’t work either.
Any ideas??