- Home /
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);
Your answer
Follow this Question
Related Questions
My OnGUI() Won't show the Button elements :( 0 Answers
I keep getting an error on my for loop. 1 Answer
Where to put the GUI script ? 3 Answers
why is my GUI script bugging other GUI scripts? 0 Answers
c# - void method from external class. 2 Answers