- Home /
Menu not working correctly.
I am using the Gamer to Game Developer tutorial to make a multiplayer game. The problem is the menu is not showing up correctly. Some of the buttons and all of the textfields are not showing up and everything is spaced weird. Here is what it should look like:
Here is what mine looks like:
Here is the code that was from the lesson that I added for this menu. I can't find what is causing the change between the lesson and mine..
if (iWantToSetUpAServer == true)
{
//The user can type a name for their server
//into the textfield
GUILayout.Label("Enter a name for your server");
serverName = GUILayout.TextField(serverName);
GUILayout.Space(5);
//The user can type in the port number for their server
//into the textfield. We define the default value
//as 26500.
GUILayout.Label ("Server Port");
connectionPort = int.Parse (GUILayout.TextField(connectionPort.ToString()));
GUILayout.Space(10);
if(GUILayout.Button("Start my own server", GUILayout.Height (30)))
{
//Create the server
Network. InitializeServer (numberOfPlayers, connectionPort, useNAT);
//Save the server name using PlayerPrefs.
PlayerPrefs.SetString("serverName", serverName);
iWantToSetUpAServer = false;
}
if(GUILayout.Button("Go Back", GUILayout.Height (30)))
{
iWantToSetUpAServer = false;
}
}
menu problem.png
(47.4 kB)
menu problem2.png
(71.2 kB)
Comment
For some reason the "Start Server" Button is the only one being created.
Yeah. It is set to true by clicking a button on another menu.