- Home /
Question by
RandomBinaries · Jan 14 at 10:20 PM ·
networkingbuttonbuttons
Why are my GUI.Button not rendering when running my networked game?
The below piece of code has been translated from JavaScript/UnityScript into C#. It works in that JavaScript/UnityScript language but when I have translated into C# it doesn't work at all could someone help this novice out please.
void OnGUI() {
if (!Network.isClient && !Network.isServer) {
if (GUI.Button(Rect(btnX, btnY, btnW, btnH), "Start Server")) {
Debug.Log ("Start Server");
startServer ();
}
if (GUI.Button(Rect(btnX, btnY * 1.2f + btnH, btnW, btnH), "Refresh Hosts")) {
Debug.Log ("Refreshing");
refreshHostList ();
}
if (hostData != null) {
for (int i = 0; i < hostData.Length; i++) {
if (GUI.Button(Rect(btnX * 1.5f + btnW, btnY * 1.2f + (btnH * i), btnW * 3, btnH * 0.5f), hostData [i].gameName)) {
Network.Connect (hostData [i]);
}
}
}
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Click through Alpha in UI 0 Answers
AddListener function not working? 6 Answers
Moving Player Left/Right with Buttons 2 Answers
UI Button Instead of OnGUI Button? 1 Answer