Object reference not set when it is?


I just keep getting this error:

NullReferenceException: Object reference not set to an instance of an object
NetworkManager.Update () (at Assets/Network Assets/Scripts/NetworkManager.cs:62)

This is how my lines look like at that part:

if (LocalServerSetup.maxPlayers <= 0) {
	LocalServerSetup.maxPlayers = 1;	

This makes 0 sense to me. Why is this happening? It have happened before but it just went a way after some time. This has been here for 1 one hour. I have tried everything to fix it but I can’t find out how.

Also, if you need them, my variables.

	public class localServerSetup{
		public string serverName = "My Server";
		public int port = 12300;
		public int maxPlayers = 4;
		public string serverPassword = "";
		public bool canStartServer = true;

Please post your answer why this is happening!


All I needed to do was to put a public in front of a part I forgot to show. Like this

public localServerSetup LocalServerSetup;