Search code examples
c#unity-game-enginenetwork-programmingunity3d-mirror

Error 'No suitable method found to override' in Unity


I'm following a tutorial video for setting up a lobby for players to host and join a game and I've been getting these errors:

error CS0115: 'NetworkManagerLobby.OnServerConnect(NetworkConnection)': no suitable method found to override

error CS0115: 'NetworkManagerLobby.OnServerAddPlayer(NetworkConnection)': no suitable method found to override
    public override void OnServerAddPlayer(NetworkConnection conn)

    public override void OnServerConnect(NetworkConnection conn)

I have included using Mirror, and the class inherits from Network Manager.

Unity version 2021.3.5f1

I'd greatly appreciate any help!


Solution

  • Are you sure your agument types are correct? I suppose it should be of type "NetworkConnectionToClient"

    public virtual void OnServerAddPlayer(NetworkConnectionToClient conn)
    
    public virtual void OnServerConnect(NetworkConnectionToClient conn) {}