Hello all,
I am dumbfounded on why my GUI Window is not opening. I have checked it 100 times and it just will not work, I am sure its something simple I just cant find what it is.
When I click on a button, GUILayout.window is supposed to open:
void OnGUI()
{
//Set Player Stats Button
if(GUI.Button(new Rect(Screen.width / 2 + 200, Screen.height / 2 + 200, playerStatsButtonWidth, playerStatsButtonHeight), "Set Player Stats"))
{
Debug.Log("clicked");
joinTeamLeftIndent = Screen.width / 2 - joinTeamWindowWidth / 2;
joinTeamTopIndent = Screen.height / 2 - joinTeamWindowHeight / 2;
joinTeamRect = new Rect(joinTeamLeftIndent, joinTeamTopIndent,joinTeamWindowWidth, joinTeamWindowHeight);
joinTeamRect = GUILayout.Window(1, joinTeamRect, MyWindowName, joinTeamWindowTitle);
}
}
Notice it calls the function: MyWindowName (just a random name I chose since I couldnt get this working). Here is that function listed in the same script.
void MyWindowName(int WindowID)
{
//Run the Stats function from the PlayerStats script.
Debug.Log ("is this running?");
//GameObject gameManager = GameObject.Find("MultiplayerManager");
//PlayerStats statScript = gameManager.GetComponent<PlayerStats>();
//
//statScript.Stats();
}
Right now I cant even get that debug.log(“is this running”) to print out. When I click on the button, the debug.log (“clicked”) does play like it should. But not the other one. What in world is happening any ideas?
Great you figured it out yourself ;) However you might want to change the questions title into something more related to the question / problem or this question / answer doesn't help much.
– Bunny83Updated :)
– madmike6537