I use VSCode for Unity development. Unfortunately, I'm not getting any IntelliSense within VSCode for my C# code. The root cause appears to be OmniSharp failing to find Mono, as the OmniSharp Logs within VSCode read:
"[ERROR] Error: Cannot start OmniSharp because Mono version >=6.4.0 is required."
This is an issue I've run into multiple times. On 3/4/2021 and for months prior everything was working just fine and IntelliSense was working perfectly for multiple Unity projects and multiple Unity versions. Then the next day it broke for some unknown reason and didn't work for any project, until late at night after trying a bunch of things I was able to get it working. And now this morning I'm once again getting this error. Each time between it working and it breaking I didn't make any changes besides restarting my computer.
- MacOS Mojave 10.14.6
- Unity 2020.2.0f1 + Visual Studio Code Editor 1.2.3 package for Unity
- VSCode 1.54.1 + C# 1.23.0 plugin for VSCode
- Mono 6.12.0.122 installed at
/usr/local/bin/monoviabrew - Mono 6.12.0 also installed manually at
/Library/Frameworks/Mono.framework/Versions/Current/Commands/ which monoin my terminal and VSCode's terminal outputs/usr/local/bin/monomono --versionin both terminals outputsMono JIT compiler version 6.12.0.122echo $PATHcontains paths to both versions of Mono,/usr/local/bin/monoappearing firstmsbuildoutputsMicrosoft (R) Build Engine version 16.6.0 for Monoandwhich msbuildoutputs/usr/local/bin/msbuilddotnet --infooutputs.NET Core SDKVersion: 3.1.201
In my VSCode's settings I've set the following:
"omnisharp.loggingLevel": "debug",
"omnisharp.monoPath": "/usr/local/bin/mono",
"omnisharp.useGlobalMono": "always"
Things I've tried:
- Downgrading/upgrading VSCode's C# plugin (including to the latest version of 1.23.9)
- Downgrading Unity's Visual Studio Code Editor package
- Switching VSCode to use the version of Mono 6.12.0 I manually installed at
/Library/Frameworks/Mono.framework/Versions/Current/Commands/(and uninstalling thebrew-installed version) - Unsetting the
omnisharpsettings in VSCode (it leads to a different error about .NET SDKs) - Deleting Unity's
.csprojand.slnfiles so that it can regenerate them - Manually telling Unity to regenerate all the
.csprojfiles - Restarting
- Looking at many forums posts and Stack Overflow questions on the topic for solutions
So does anyone have any suggestions for getting IntelliSense working in VSCode? Any tips for debugging why OmniSharp can't find Mono? I feel like I've done everything in my power to point OmniSharp to the correct place, I wish it logged a bit more about what it was trying.