x


Same GUI script showing up in different places

Hello all:

Right now I have a piece of code that displays an objective when a certain location is reached. Inside of the moveCamera script it is currently in it shows up where I want it. But when I move it to a new script it is halfway off the screen. I use the same dimensions and location for the rectangle in both scripts, and I never set the resolution of the screen in either script. Any idea why this might be happening? I have a piece of code running in each script that tells me what the resolution on my screen is. In both places it says 1024x768 (standard webplayer resolution).

Code follows:

WaypointScript.cs

public static void GetCurrentObjective(GameObject[] go, string objective)
{     
    if(displayObjective == true)
    {
       GUILayout.BeginArea(moveCamera.learningObjRect);
       if(GUILayout.Button("X"))
       {
         displayObjective = false;
         GameManager.EnableLights(go, true);
       }

       GUILayout.Box(objective);
       GUILayout.EndArea();
    }
}

moveCamera.cs

if (displayObjective)
    {
       GUILayout.BeginArea(learningObjRect);
       if(GUILayout.Button("X"))
       {
         displayObjective = false;
         GameManager.EnableLights(questionOne, true);
       }
       GUILayout.Box ("objective here");
       GUILayout.EndArea();
    }

and learningObjRect

Rect learningObjRect = new Rect (Screen.width / 2 - 200, 20,400,220);
more ▼

asked Jul 07 '11 at 05:05 PM

dibonaj gravatar image

dibonaj
233 13 17 17

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x4157
x3689
x3330
x242

asked: Jul 07 '11 at 05:05 PM

Seen: 663 times

Last Updated: Jul 07 '11 at 07:27 PM