/// <summary> /// Called on the server when a client adds a new player with ClientScene.AddPlayer. /// <para>The default implementation for this function creates a new player object from the playerPrefab.</para> /// </summary> /// <param name="conn">Connection from client.</param> public override void OnServerAddPlayer(NetworkConnection conn) { Transform startPos = GetStartPosition(); GameObject player = startPos != null ? Instantiate(playerPrefab, startPos.position, startPos.rotation) : Instantiate(playerPrefab); LocalPlayers[conn] = player.GetComponent <NetworkIdentity>(); // Added by FPSLANDS NetworkServer.AddPlayerForConnection(conn, player); RelayOnServerAddPlayer?.Invoke(conn); // Added by FPSLANDS }
/// <summary> /// Called on the server when a client adds a new player with ClientScene.AddPlayer. /// <para>The default implementation for this function creates a new player object from the playerPrefab.</para> /// </summary> /// <param name="conn">Connection from client.</param> public override void OnServerAddPlayer(NetworkConnection conn) { base.OnServerAddPlayer(conn); RelayOnServerAddPlayer?.Invoke(conn); }