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

OnServerAddPlayerInternal() private method

private OnServerAddPlayerInternal ( NetworkConnection conn, short playerControllerId ) : void
conn NetworkConnection
playerControllerId short
return void
        private void OnServerAddPlayerInternal(NetworkConnection conn, short playerControllerId)
        {
            if (this.m_PlayerPrefab == null)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("The PlayerPrefab is empty on the NetworkManager. Please setup a PlayerPrefab object.");
                }
            }
            else if (this.m_PlayerPrefab.GetComponent<NetworkIdentity>() == null)
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("The PlayerPrefab does not have a NetworkIdentity. Please add a NetworkIdentity to the player prefab.");
                }
            }
            else if (((playerControllerId < conn.playerControllers.Count) && conn.playerControllers[playerControllerId].IsValid) && (conn.playerControllers[playerControllerId].gameObject != null))
            {
                if (LogFilter.logError)
                {
                    Debug.LogError("There is already a player at that playerControllerId for this connections.");
                }
            }
            else
            {
                GameObject obj2;
                Transform startPosition = this.GetStartPosition();
                if (startPosition != null)
                {
                    obj2 = UnityEngine.Object.Instantiate<GameObject>(this.m_PlayerPrefab, startPosition.position, startPosition.rotation);
                }
                else
                {
                    obj2 = UnityEngine.Object.Instantiate<GameObject>(this.m_PlayerPrefab, Vector3.zero, Quaternion.identity);
                }
                NetworkServer.AddPlayerForConnection(conn, obj2, playerControllerId);
            }
        }