So I’'m having a problem setting up GUI interface, placing elements where I want them…
I get nothing on-screen when the button Show Server Logs is pressed, I read up about the GUILayour tutorial but still can’t wrap my head around it…
Is there something I am doing wrong?
Should I place the GUILayout.BeginVertical somewhere else in the OnGUI()?
void OnGUI()
{
GUILayout.BeginArea(new Rect(10, 10, Screen.width, Screen.height));
if (Network.peerType == NetworkPeerType.Disconnected)
{
if (GUILayout.Button("Start Server", GUILayout.Width(120), GUILayout.Height(25)))
{
Network.InitializeSecurity();
Network.InitializeServer(_maxConnections, _serverPort, true);
Debug.Log("Server is starting up..");
}
}
else
{
if (GUILayout.Button("Show Server Logs", GUILayout.Width(120), GUILayout.Height(25)))
{
Debug.Log("Showing server logs.");
GUILayout.BeginVertical();
GUILayout.Box("Server Console" + _serverMessages, GUILayout.Width(Screen.width), GUILayout.Height(200));
GUILayout.EndVertical();
}
if (GUILayout.Button("Shutdown Server", GUILayout.Width(120), GUILayout.Height(25)))
{
Network.Disconnect(500);
Debug.Log("Server is shutting down..");
}
}
GUILayout.EndArea();
}