Hey all,
I’m getting some really odd behaviour in both Visual Studio Code and Unity, and I’m not sure where the issue is coming from, or how to fix.
I’m able to successfully import Mirror Components to Game Objects (i.e Default Network Manager), and am able to use Mirror Networking successfully (can spawn in Player Objects, and they move over the network)
I’m getting issues when it comes to adding Public Overrides in a custom Network Manager script.
This is my code in my custom Network Manager Script (yes, this is it)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mirror;
public class RTSNetworkManager : NetworkManager
{
public override void onServerAddPlayer(NetworkConnection conn)
{
base.onServerAddPlayer(conn);
}
}
After typing this in, I get the following Compiler Error in theUnity Console:
Assets\Scripts\Networking\RTSNetworkManager.cs(8,26): error CS0115: 'RTSNetworkManager.onServerAddPlayer(NetworkConnection)': no suitable method found to override
When I remove the onServerAddPlayer
function from this script, the script compiles successfully
When going through the first part of this course, I didn’t have any issues with this occurring at all, it’s only happened once moving to the actual “RTS” part of the course
Additionally, it seems that Visual Studio Code (or one of the extensions) is not working properly either. When replacing MonoBehaviour
with NetworkManager
, this should throw an error in VSCode which prompts me to add using Mirror;
- this doesn’t appear at all.
When I start typing and the Predictive box comes up, this still only shows MonoBehaviour content, and nothing from Network Manager
What’s really odd is that I don’t get error CS0115 in the previous section’s project, however that project is now also affected by the VSCode glitches, which leads me to believe they are either Separate issues, or VSCode is the true culprit here
These are my troubleshooting steps:
- 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.26f1
- VSCode Version: 1.67.2
- Installed VSCode Extensions:
- C# for Visual Studio Code
- Debugger for Unity
- GitLens
- PHP Intelephense
- Unity Code Snippets
If anyone can figure out what’s going on here, that would be great - I’m pulling my hair out here!