GUI screen placement

I am having problems placing the GUI on the iphone. I am trying to place a row of buttons along the bottom of the screen. Here is my simple code: ( I am using horizontal iphone orientation)

        // Wrap everything in the designated GUI Area
        GUILayout.BeginArea(new Rect(0, (Screen.height-80), Screen.width, 80));
        
        // Begin the singular Horizontal Group
        GUILayout.BeginHorizontal();

        // Place Buttons
        string buttonName = "blahblah ";
        for (int i = 0; i <= 6; i++) 
        { 
            GUILayout.Button((buttonName+i.ToString()));
        }

        GUILayout.EndHorizontal();
        GUILayout.EndArea();

It is my understanding that the positioning of the Area above using Screen.height should accomplish this. Also because the Area is limited to Screen.width for the with of the area the buttons should stop at the edge of the screen. Neither of the above is happening. Buttons are not at the bottom of the screen (they are about 2/3 down the screen) and they do not end on the right side of the screen.

Now I have read that Viewport in the IDE will not show accurate positioning relative to the iphone if the dimensions are off. So I have configured the viewport to be 480 x 320 (the iphones dimensions) using the “Status” button above the viewport. This changed nothing. The buttons are not positioned properly regardless of whether I look at the viewport in the editor, look at the iphone using Unity Remote, or compile the build and put it on the iphone.

What is the solution to this problem?

I have also tried replacing “Screen.height” with “Camera.main.pixelRect.height” and this still gives me the same results. How is everybody else controlling GUI layout?

I figured out the problem and just want to update this in case someone runs into this problem in the future. GUILayout was placing the controls correctly on the screen however the controls (buttons in this case) have a default dimensions. I was assuming “Automatic Layous” would automatically scale the controls to fit the area; it doesn’t. Buttons are by default 20 pixels tall. So in my first example I was lifting them off the bottom of the screen by 80 pixels and expecting the buttons to be 80 pixels tall. However, they are only 20 pixels tall and this caused them to look like they were hanging in mid-air and that maybe the screen.height was not being calculated correctly. Change 80 to 20 and the buttons are now back on the bottom of the screen.