I'm using VS Code and Unity, and I noticed that errors are showing on Unity console but not the VS Code, I looked up and did everything that this page says and nothing worked: https://code.visualstudio.com/docs/other/unity
Is there a fix to this?
I had this problem too. One day Code's errors were connected, the next day, they had disappeared. Most frustrating. This worked for me:-
Install the latest .net SDK from here DotNet SDK download
2) Regenerate project files from Edit->Preferences->External Tools
Note: just regenerating the project files didn't work for me. Needed DotNet SDK update.
Related
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/mono via brew
Mono 6.12.0 also installed manually at /Library/Frameworks/Mono.framework/Versions/Current/Commands/
which mono in my terminal and VSCode's terminal outputs /usr/local/bin/mono
mono --version in both terminals outputs Mono JIT compiler version 6.12.0.122
echo $PATH contains paths to both versions of Mono, /usr/local/bin/mono appearing first
msbuild outputs Microsoft (R) Build Engine version 16.6.0 for Mono and which msbuild outputs /usr/local/bin/msbuild
dotnet --info outputs .NET Core SDK Version: 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 the brew-installed version)
Unsetting the omnisharp settings in VSCode (it leads to a different error about .NET SDKs)
Deleting Unity's .csproj and .sln files so that it can regenerate them
Manually telling Unity to regenerate all the .csproj files
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.
I was able to resolve the issue by downgrading Visual Studio Code to 1.52.1 at https://code.visualstudio.com/updates/v1_52 and turning off automatic updates in VS Code. OmniSharp is now working without any exceptions. Seems likely that the root cause lies with VS Code 1.54 (or possibly 1.53)
I had this same problem (no Intellisense). Tried many of the things listed here and elsewhere. Turned "ominsharp.useGlobalMono" to "never" as suggested most places, and restarted omnisharp when prompted, and it changed nothing. However, I got an error that I didn't get before (didn't save it, but it's the message stating that older versions of mono(?) aren't supported).
I therefore put it back (to "always") and restarted omnisharp when prompted...and autocomplete works. Didn't even exit VS code. Scripts were still open. No clue why it works now, but it does. So....set to never and back to always?
Using VS Code v 1.55.2.
Using dotnet 5.0.202
Set "omnisharp.useGlobalMono" to "never", and make sure you have a .NET .sln file for your project in the root of your workspace. If the solution is not in the root of your workspace, press Ctrl+Shift+P, and run "OmniSharp: Select Project" to select your .sln file.
Tested with the following setup:
Home - VS2017 or VS2019
Classroom - VS2013 or VS2015.
I do code at home, then copy to my flash drive, bring it to the classroom and open a project from their PCs. Upon compilation I receive a big list of errors accessing standard header files, similar to this. Happens to me with every project I create at home, and the other way around: from the classroom to home PC.
This is something that doesn't happen with C# projects, which only ask me to change the .net framework version before opening, everything works fine here.
If you created a project in VS2013 and try to open it in VS2017 or VS2019 you might need additional changes.
Check this out- https://learn.microsoft.com/en-us/visualstudio/porting/port-migrate-and-upgrade-visual-studio-projects?view=vs-2019
If you created a project in the latest version say VS2019, it is very difficult to open it in older versions such as VS2013.
To fix it set the Omnipath to latest in vscode settings
I am wondering if anyone can help me, I did a fresh install of MonoDevelop on a fresh install of Ubuntu 18.04.2 LTS with .NET Core 2.2 installed (everything updated), then followed the instructions layed out at Mono Download Offical. I have no errors or warnings during installation.
When I create any type of project or open one, all the system namespaces are missing?
I have checked here:
And
When I build / Clean any project I get:
/home/ant/.cache/MonoDevelop/7.0/MSBuild/27259_1/Microsoft.CSharp.CurrentVersion.targets(5,5):
Error MSB4019: The imported project
"/home/ant/.cache/MonoDevelop/7.0/MSBuild/27259_1//Microsoft.CSharp.Core.targets"
was not found. Confirm that the path in the declaration is
correct, and that the file exists on disk. (MSB4019) (sadsad)
Error
I solved it temporarily:
I went to the Namespace/Class options and under Run - Default - Advanced I selected Execute in .NET runtime -> Mono 5.20.1.34
It fixes the problem until i restart Monodevelop.
I'm having this problem since this morning, even after a fresh reinstall.
I am using Ubuntu MATE 18.04
This was a problem with mono its self, mono updated and was using a different version of MsBuild which the IDE could not use/understand. So I pulled the preview repository, as they added a fix there.
To fix:
purge monodevelop and mono-devel (with others) and install from here Preview - Stable until they patch the normal repository
I had the same problem with Monodevelop under Raspian (Rasberry3)
I believe I can now offer a viable solution:
It's just a setting that has to be done in Monodevelop before you start a new project:
Search under the settings, create and disable the line "create with MSBuild instead of xbuild".
After that all new projects will be recognized without errors.
For old projects the procedure is similar:
but there you should delete the folder ".vs" in the project folder first (better make a backup copy first! ;) ).
Start Monodevelop. Check that the settings are as described above.
Then open the project in Monodelop.
When you open the project, it will be reinitialized and can then be edited and compiled without any problems.
I followed all the steps listed in here but I still have no intellisense. Not for C#, not for Unity 3D. What am I missing?
VS Code version is 1.22.1
OSX is 10.12.6
Unity installation path is /Applications/Unity, version is 2017.3.1f1
Installed dotnet-sdk-2.1.103-osx-x64
Installed MonoFramework-MDK-5.8.1.0.macos10.xamarin.universal
Installed extensions listed in screenshot 1
Restarted
Tried to delete csproj and sln files
Still nothing, see screenshot 2
When launched from Unity 3D, VS Code seems to load the entire solution successfully. Then, if I force intellisense suggestions popup by hitting CTRL+Space, I only get a Loading... for quite a while, then No suggestions.
I recently got a new computer but I chose to install VS2015 after reinstalling Unity. I previously used monodevelop but thought I'd give VS a go (partially because it became the default program when opening scripts through Unity and I can't seem to change that).
I am however having a few problems due to the intellisense/auto complete function not working. I've read through a lot of answers on here but nothing seems to help.
My suggestion would be to rebuild your solution files.
From your projects root folder, copy Assets and Project Settings ONLY over to a new directory. From here open up one of your scenes, Unity will import assets and build the scene.
Once open, go to Edit -> Preferences -> External Tools and make sure that Visual Studio 2015 is selected as the External Script Editor and then go Assets -> Sync MonoDevelop Project (Ignore the name MonoDevelop!)
See if that works for you.
Failing that follow the guide here and note what version of Unity you are using as there are different steps for pre 5.2 Getting Started with Visual Studio Tools for Unity
And if that doesn't work, it's going to be a problem with your Visual Studio install. I've had this before even on a new install. So try a re-install as a last resort.