UnityEngine.Networking.NetworkManager.SetMatchHost C# (CSharp) Method

SetMatchHost() public method

This sets the address of the MatchMaker service.

public SetMatchHost ( string newHost, int port, bool https ) : void
newHost string Hostname of MatchMaker service.
port int Port of MatchMaker service.
https bool Protocol used by MatchMaker service.
return void
        public void SetMatchHost(string newHost, int port, bool https)
        {
            if (this.matchMaker == null)
            {
                this.matchMaker = base.gameObject.AddComponent<NetworkMatch>();
            }
            if (newHost == "127.0.0.1")
            {
                newHost = "localhost";
            }
            string str = "http://";
            if (https)
            {
                str = "https://";
            }
            if (newHost.StartsWith("http://"))
            {
                newHost = newHost.Replace("http://", "");
            }
            if (newHost.StartsWith("https://"))
            {
                newHost = newHost.Replace("https://", "");
            }
            this.m_MatchHost = newHost;
            this.m_MatchPort = port;
            object[] objArray1 = new object[] { str, this.m_MatchHost, ":", this.m_MatchPort };
            string uriString = string.Concat(objArray1);
            if (LogFilter.logDebug)
            {
                Debug.Log("SetMatchHost:" + uriString);
            }
            this.matchMaker.baseUri = new Uri(uriString);
        }

Usage Example

コード例 #1
0
    void Awake()
    {
        manager = GetComponent<NetworkManager>();
        manager.StartMatchMaker();
        manager.SetMatchHost("mm.unet.unity3d.com", 443, true);

        manager.matchMaker.ListMatches(0, 20, "", UpdateListing);
    }
All Usage Examples Of UnityEngine.Networking.NetworkManager::SetMatchHost