示例#1
0
    /// <summary>
    /// Starts hosting a server given a address, port, and password to host it with
    /// </summary>
    /// <param name="address">The address the server will be hosting on</param>
    /// <param name="port">The port the server will be hosting on</param>
    /// <param name="password">The password used to connect to the server. Leave blank if no password is required</param>
    public void Host(int port, string password = "")
    {
        if (m_Client != null)
        {
            Destroy(m_Client);
        }

        m_IsPlaying = true;
        m_Server.Create(port);
    }
示例#2
0
 public void Awake()
 {
     if (Instance != null)
     {
         Destroy(this.gameObject);
     }
     DontDestroyOnLoad(this.gameObject);
     Instance = this;
     network  = NetworkServer.Create();
 }