Master Server--- I am puzzled

Hi there i took code strait from the unity reference for the master server and it gives me an error in VisulStudio Assets/MasterServer.cs(12,26): error CS0117: MasterServer' does not contain a definition for RegisterHost’

Here is my code i will include it all so you can see everything.(xPos, yPos + more are just there so i can position things exactly how i want them)

It is on line 44 look for a lot of //////// Just marking it so it’s easy to find

using UnityEngine;
using System.Collections;

public class NetworkingGUI : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}

    public int xPos = 400;// The position of the box in x 
    public int yPos = 300;// the position of the box in y
    public int boxSizeX = 800;
    public int boxSizeY = 600;
    public float hSliderValue = 0.0F;
    public GUIStyle levelButton;
    public Texture2D spacer;
    private string passwordToEdit = "My Password";
    private string stringToEdit =  "Server Name";
    private string maxPlayers = "Max Players";
    public int levelToLoad = 0;
    void OnGUI(){
        
        
        GUI.Box(new Rect(Screen.width / 2 - 263 , Screen.height / 2 - 212 ,Screen.width / 2,Screen.height /2), "Network");

        if (GUI.Button(new Rect(Screen.width / 2 - 240, Screen.height / 2 - 44, Screen.width / 8, Screen.height / 8), "Level Select"))
        {
            Debug.Log("We Pressed The Button");// When we click the button display a log letting us know 
        }
        if (GUI.Button(new Rect(Screen.width / 2 - 240, Screen.height / 2 + 55, Screen.width / 8, Screen.height / 16), spacer, levelButton))
        {
            levelToLoad = 1;
        }
        if (GUI.Button(new Rect(Screen.width / 2 - 263, Screen.height / 2 + 106, Screen.width / 2, Screen.height / 32), "Create Server"))
        {
            bool useNat = !Network.HavePublicAddress();////////////////////////////////////////////////////////////////////////////////////
            Network.InitializeServer(32, 25002, useNat);/////////////////////////////////////////////
            MasterServer.RegisterHost("MyUniqueGameType", "JohnDoes game", "l33t game for all");////////////////////////
        }
        if (GUI.Button(new Rect(Screen.width / 2 - 263, Screen.height / 2 + 134, Screen.width / 2, Screen.height / 32), "Back"))
        {
            Debug.Log("We selected a level");
        }
        passwordToEdit = GUI.PasswordField(new Rect(Screen.width / 2 + 52 ,Screen.height / 2 - 96,Screen.width / 2 - 329 ,Screen.height / 2 - 360), passwordToEdit, "*"[0], 25);// password input 
        stringToEdit = GUI.TextField(new Rect(Screen.width / 2 + 52, Screen.height / 2 - 132, Screen.width / 2 - 329, Screen.height / 2 - 360), stringToEdit, 25); // This is to name your server
        hSliderValue = GUI.HorizontalSlider(new Rect(Screen.width / 2 +50, Screen.height / 2 - 165, Screen.width / 2 - 329, Screen.height / 2 - 360), hSliderValue, 0.0F, 10.0F);
        GUI.Label(new Rect(Screen.width / 2 - 241, Screen.height / 2 - 96, Screen.width / 2 - 329, Screen.height / 2 - 360), "Server PassWord"); // This si the password field
        GUI.Label(new Rect(Screen.width / 2 - 241, Screen.height / 2 - 132, Screen.width / 2 - 329, Screen.height / 2 - 360), "Server Name"); // This si the server name input
        GUI.Label(new Rect(Screen.width / 2 - 241, Screen.height / 2 - 168, Screen.width / 2 - 329, Screen.height / 2 - 360), "Number O Players"); // This si the server name input
        GUI.Box(new Rect(Screen.width / 2 + 81, Screen.height / 2 - 194, Screen.width / 2 - 402, Screen.height / 2 - 361),("MaxPlayers" + Mathf.RoundToInt(hSliderValue))); // Display the amount of possible players 
        
     
        

               

    }
}

I don’t know what the error is, all I know is that I’ve never used the MasterServer without a couple of things I don’t see in your script: HostData, and RequestHostList. I would suggest putting those in your script and see if that helps any. Like I said, I don’t know what’s causing your error, but it’s worth a shot.

  • WolfShield