Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

Assets\CustomNetworkManager.cs(13,26): error CS0115: 'CustomNetworkManager.OnServerAddPlayer(Network

Discussion in 'Multiplayer' started by Blazeist, Feb 26, 2023.

  1. Blazeist


    Feb 23, 2023
    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<PlayerObjectController> GamePlayers { get; } = new List<PlayerObjectController>();

    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);
  2. CodeSmile


    Apr 10, 2014
    Please use code tags.
    The error message you get tells you a lot about what's wrong actually, and also where ("13,26" reads as: line 13, character 26). Remove the override.