- Home /
GUILayout element alignment issue
Hello everyone!
I have an issue with my menu for my game. It worked before, when I used Unity's Network, but now it just doesn't seem to work. Any ideas?
private void CreateNetwork() {
GUILayout.BeginArea(new Rect(Screen.width / 2 - 150, Screen.height / 2 - 79, 300, 158), "", menuBox);
GUILayout.BeginHorizontal();
GUILayout.BeginVertical();
GUI.skin.label = menuTitle;
GUILayout.Label("RoyalGoo Lands DEV Client");
GUI.skin.label = menuNetworkLabel;
GUILayout.BeginHorizontal();
GUILayout.Label("Status: " + PhotonNetwork.connectionStateDetailed.ToString(), GUILayout.Height(23));
if(!PhotonNetwork.connected)
GUI.skin.button = menuButton;
else
GUI.skin.button = menuButtonDisabled;
string buttonText;
if(!PhotonNetwork.connected)
buttonText = "Connect";
else
buttonText = "Disconnect";
if(GUILayout.Button(buttonText, GUILayout.Height(23)) && (PhotonNetwork.connectedAndReady || !PhotonNetwork.connected))
if(!PhotonNetwork.connected)
// Join
GUILayout.EndHorizontal();
if(PhotonNetwork.connectedAndReady) {
GUI.skin.textField = menuField;
GUI.skin.button = menuButton;
}
else {
GUI.skin.textField = menuFieldDisabled;
GUI.skin.button = menuButtonDisabled;
}
if(PhotonNetwork.connectedAndReady)
playerName = GUILayout.TextField(playerName);
else
GUILayout.TextField(playerName);
if(GUILayout.Button("Spawn") && PhotonNetwork.connectedAndReady)
// Spawn
if(!PhotonNetwork.connected)
GUI.skin.button = menuButton;
else
GUI.skin.button = menuButtonDisabled;
if(GUILayout.Button("Refresh server") && !PhotonNetwork.connected)
// Refresh
GUILayout.BeginHorizontal();
// Elements
GUILayout.EndHorizontal();
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.EndArea();
}
Comment