public void ServerOnReceivePlayerInfo(string playerName) { var connectionId = ServerPeer.CurrentRpcSenderConnectionId; var playerId = GenerateNetworkId(); // Store information about the client. playerIdsByConnectionId.Add(connectionId, playerId); // create player data object var playerState = new PlayerState { Id = playerId, Name = playerName, Kills = 0, Deaths = 0 }; PlayerObjectSystem.Instance.CreateLocalPlayerDataObject(playerState); // Let the client know its player ID. ServerPeer.CallRpcOnClient("ClientOnSetPlayerId", connectionId, ServerPeer.reliableSequencedChannelId, new { playerId = playerId }); // Spawn the player. PlayerRespawnSystem.Instance.ServerSpawnPlayer(this, playerId); // Send out a chat message. ServerPeer.CallRpcOnAllClientsExcept("ClientOnReceiveChatMessage", connectionId, ServerPeer.reliableSequencedChannelId, new { playerId = (uint?)null, message = $"{playerName} joined." }); }