Can anyone help me with this problem im having?
Here’s the script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mirror;
using UnityEngine.SceneManagement;
using Steamworks;
public class CustomNetworkManager : NetworkManager
{
[SerializeField]private PlayerObjectController GamePlayerPrefab;
public List GamePlayers { get; } = new List();
public override void OnServerAddPlayer(NetworkConnection conn)
{
if(SceneManager.GetActiveScene().name == “Lobby”)
{
PlayerObjectController GamePlayerInstance = Instantiate(GamePlayerPrefab);
GamePlayerInstance.ConnectionID = conn.connectionId;
GamePlayerInstance.PlayerIdNumber = GamePlayers.Count + 1;
GamePlayerInstance.PlayerSteamID = (ulong)SteamMatchmaking.GetLobbyMemberByIndex((CSteamID)SteamLobby.Instance.CurrentLobbyID, GamePlayers.Count);
NetworkServer.AddPlayerForConnection(conn, GamePlayerInstance.gameObject);
}
}
}