Quantcast
Channel: Latest Questions by brandonhotdo
Viewing all articles
Browse latest Browse all 108

NullReference

$
0
0
I have gotten a null reference exception on line 10 using UnityEngine; using System.Collections; public class MainMenu : MonoBehaviour { public int ServerPort = 25565; public int MaxiPlayers = 27; void OnGUI(){ if(GUI.Button(new Rect(Screen.width/2-310,Screen.height/2-175,183,28),"StartServer")){ NetworkManager2.Instance.StartServer(MaxiPlayers,ServerPort); } } } And on the script NetworkManager2 using UnityEngine; using System.Collections; public class NetworkManager2 : MonoBehaviour { public static NetworkManager2 Instance; // Use this for initialization void Start () { Instance = this; } public void StartServer(int MaxPlayers, int Port){ Debug.Log ("Good"); } } I don't know why I get the error! I heard that you can ignore it but then it does not do the void (It does not do what is in StartServer!).

Viewing all articles
Browse latest Browse all 108

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>