Hey there,
I am having the same sort of issue depicted in the topic Odd behaviour - Mirror imported, but not found
The compiler error we get is:
‘Assets\Scripts\Networking\RTSNetworkManager.cs(12,26): error CS0115: ‘RTSNetworkManager.OnServerAddPlayer(NetworkConnection)’: no suitable method found to override’
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mirror;
public class RTSNetworkManager : NetworkManager {
[SerializeField] private GameObject unitSpawnerPrefab = null;
public override void OnServerAddPlayer(NetworkConnection conn)
{
base.OnServerAddPlayer(conn);
GameObject unitSpawnerInstance = Instantiate(unitSpawnerPrefab, conn.identity.transform.position, conn.identity.transform.rotation);
NetworkServer.Spawn(unitSpawnerInstance, conn);
}
Here is what VScode says when I hover the mouse over the red underlined ‘conn’:
Argument 1: cannot convert from ‘Mirror.NetworkConnection’ to ‘Mirror.NetworkConnectionToClient’ [Assembly-CSharp]csharp(CS1503)
I have followed all the steps Patrick_Hull took with troubleshooting. I will Paste that info here. Anything BOLD means a change from the original post:
Unity Error
- Restarted Unity Editor
- Restarted PC
- Copied NetworkManager script from earlier section
- Removed all .csproj files
- Removed .sln files
- Reimported Mirror
- Removed project from PC and re-cloned from GitHub
- Created new project from scratch
VSCode Error - Uninstalled relevant extensions (In bold below)
- Reinstalled VSCode
Specs - Unity Version: 2020.3.32f1
- VSCode Version: 1.68.1
Installed VSCode Extensions: - C# for Visual Studio Code (ver. 1.25.0)
- Debugger for Unity
- GitLens
- Unity Code Snippets
Patrick_Hull SOLUTION:
Here is the text from the thread answer in regards to using the C# for Visual Studio Code extension version 1.25.0:
.NET Framework builds of OmniSharp no longer ship with Mono or the MSBuild tooling (See announcement omnisharp-roslyn#2339). To ensure that the C# extension remains usable out of the box for .NET SDK projects, we have changed the default value of omnisharp.useModernNet to true.
If you still need Unity or .NET Framework support, you can set omnisharp.useModernNet to false in your VS Code settings and restart OmniSharp.
So I set my Vscode omniharp.useModernNet setting to false. Nothing has changed.
There is a second potential solution in the thread pointing to installing the dotNet SDK 6. I did this, but still no change.
I have yet to reformat my entire system, though I’d rather not have to resort to that. I’m not code savvy enough to create a workaround at this time. If anyone has any troubleshooting steps for me to jump through please let me know and I’ll report my findings.
Thank you for your time.