private IEnumerator GetAssignPublicIPAddress() { WWW myExtIPWWW = new WWW("http://checkip.dyndns.org"); if (myExtIPWWW == null) { yield break; } yield return(myExtIPWWW); string myExtIP = myExtIPWWW.text; myExtIP = myExtIP.Substring(myExtIP.IndexOf(":") + 1); myExtIP = myExtIP.Substring(0, myExtIP.IndexOf("<")); CmdSetHostIP(MultiplayerManager.GetLocalIPAddress(), myExtIP); }
// Use this for initialization void Start() { instance = this; //Variable initialization manager = MultiplayerManager.GetInstance(); //This if statement statement checks if it's running on the host if (!MultiplayerManager.IsHost()) { startButton.SetActive(false); gameOptions.SetActive(false); } else { CmdSetHostName(MultiplayerManager.GetLocalPlayer().name); CmdSetHostIP(MultiplayerManager.GetLocalIPAddress(), "Fetching..."); StartCoroutine(GetAssignPublicIPAddress()); } OnHostNameChange(hostName); OnHostPubIPChange(hostPublicIP); OnHostLANIPChange(hostLANIP); }