Intelisense problem

EDIT note: anyone experiencing similar problems can skip to the later posts: the problem seems to be related to an update to Omnisharp which removes Mono and MSBuild Tools - I have just managed to get Intellisense to work, but am not sure if it’s a viable solution.

Hi,
I’m having real problems getting the Intellisense to work. I have tried to follow the ‘Intellisense Issues’ guide as best I can, but I’m getting a bit lost now.

I’m using Unity version 2021.3.5f1 Personal; VS Code 1.69.1
Following the guide I have:

1.Visual Studio Editor installed and appearing in Unity Package Manager

2.Everything set in External Tools as suggested and regenerated project files


3.Have installed the relevant NET SDK?

I cannot find .NET Core SDK - do I need that? Or is it included in the latest version of .NET SDK?

  1. The Extensions I have installed in VS Code are as below (C# and Unity Code Snippets)

  2. When I try to follow Rick I don’t get the Intellisense stuff - last time I tried hitting CTRL + Shift + Space
    I got the error message below:

Tried restarting everything and get errors below:

(Win32Exception: The system cannot find the file specified.

System.Diagnostics.Process.StartWithShellExecuteEx (System.Diagnostics.ProcessStartInfo startInfo) (at :0)
System.Diagnostics.Process.Start () (at :0)
(wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
VSCodeEditor.VSCodeScriptEditor.OpenProject (System.String path, System.Int32 line, System.Int32 column) (at Library/PackageCache/com.unity.ide.vscode@1.2.5/Editor/VSCodeScriptEditor.cs:219)
Unity.CodeEditor.CodeEditor.OpenProject (System.String path, System.Int32 line, System.Int32 column) (at <1f0be198f5164d2489de92f22c998266>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

This error is now appearing whenever I try to create a C# script. I tried deleting my ‘Movement’ script and creating a new one - got this error. Something has got messed up and I don’t know how to fix it - so cannot proceed with project.

Which file can’t it find?

This error is now appearing in all my projects when I try to open a script

  1. I cannot find an option for Omnisharp : Use Global Mono. Maybe it’s the version of VS Code I am using? When I hover over the settings icon for the C# extension is says ‘This extension is enabled globally’ - does that have anything to do with it??

  2. Should Omnisharp:Use Modern Net be selected or not? It says something about not being supported in Unity (if selected?)

I have spent several hours trying to fix this and am now lost as what to do next.

Any replies need to be aimed at a complete beginner please…I am not very comfortable installing lots of things on my computer when I have no idea what they are and what they do. Any advice needs to be step by step and as simple as possible.

Also, how essential is Intellisense?

Thanks in advance

1 Like

Hi Robablopacus,

“Use Modern Net” is supposed to be disabled. Please follow the instruction on this website if you haven’t already: https://code.visualstudio.com/docs/other/unity

Maybe you’ll have to reboot your computer. Then launch Unity again and open one of your scripts.

If VS Code still does not work properly, you could install and use Visual Studio (Community Edition). For some students, VS Code simply does not work well. Maybe due to a problem with Unity, some update or whatever.

Also, how essential is Intellisense?

It is essential for modern programming because it saves us time. However, if nothing helps, you could type the relevant code yourself. In the end, the code is just text, and it does not matter how it was created.

1 Like

Hi Nina,

Thanks for replying. My main problem at the moment, besides Intellisense not working is that now every time I open a C# script I get the error message mentioned in my original post (see 5.) - until I fix this I cannot proceed with any project.

For instance - before I tried to fix the Intellisense my projects were working fine - now when I open a script in any project I get an error saying file not found

Here’s an example from my Obstacle course project:

On the Intellisense issue the link: Visual Studio Code and Unity
is helpful and I followed it as well as I could but I think it might be out of date. The download .NET link no longer has a download for .NET core sdk - this is why I asked whether it is needed or not.

Many thanks,

Rob

1 Like

The error messages in your console might refer to the Visual Studio Code Editor package. In Unity, go to Edit > Preferences > External Tools. Then click on “Regenerate project files”. Maybe that’ll fix the problem.

You do not need the .NET Core SDK. Download and install .NET Framework 4.7.1 (Developer Pack) from the official Microsoft website. Here is the link: https://dotnet.microsoft.com/download/dotnet-framework/net471

1 Like

I have already installed .NET Framework 4.7.1.

Tried the ‘Regenerate project files’ - didn’t work.

Went into Package Manager and noticed Visual Studio Editor needed updating so tried that - the error went away but came back as soon as I opened another script.

Are Visual Studio Editor and Visual Studio Code Editor two different programs - do I need both of them?

1 Like

Did you install the Developer Pack? The “normal” version does not work. That’s why I explicitely mentioned and linked the required one.

Yes, Visual Studio and Visual Studio Code are two different programs. So are the Visual Studio Editor and the VIsual Studio Code Editor package.

1 Like

Hi Nina,

Yes, I installed the .NET Framework 4.7.1 Developer pack.

I’m thinking of trying a complete uninstall / reinstall of VS Code to see if that helps - and if not, trying Visual Studio (community Edition) as you suggested. Unless there’s anything else you think I could try first?

Thanks

1 Like

After you uninstalled VS Code, restart your computer first. Then install VS Code again.

1 Like

Hi Nina,

Well - good news first: a reinstall seems to have fixed the error message problem

Bad News: I am now back to where I started with Intellisense not doing it’s job…

Just to be clear, I am getting predictive stuff appearing but it’s not the same as Rick’s - for instance, I don’t get all the different keys appearing after typing Keycode. (CTRL + Shift + SPACE does nothing)

See image:
My version on the left / Rick’s on the right

I also notice comparing the two images that I don’t get the stuff at the top: Assets > Movement > ProcessInput …?

So…what next? Try Visual Code Community? Carry on without Intellisense or is there something else we can try with Visual Studio Code?

I just noticed something else: i adjusted the Omnisharp project load timeout from 60 seconds to 600…because it seemed to be having problems with server load time out(??)

Closed everything down and restarted but the OmniSharp log is showing the message below

is this significant that Omnisharp is not registering?

Edit Note: I have just googled Omnisharp MSBuild and it does seem this is related to Intellisense not working

c# - Could not locate MSBuild instance to register with OmniSharp - Stack Overflow

‘As of May 2022, Omnisharp does not include MSBuild’ then someone comments
‘Hey, Unity User which face IntelliSense problem after May 2022! This is what you need…’

Visual Studio Build Tools?

There is also this:
Announcement: Planned removal of the included Mono & MSBuild tools · Issue #5120 · OmniSharp/omnisharp-vscode · GitHub

Seems to be related to the useModernNet setting?

Not sure about this…can anyone advise?

1 Like

Okay - update is I seem to have fixed the problem

Solution: In VSCode / C# settings / Extension settings / Omnisharp:use Modern net - click to select

This is contrary to advice given by GameDev, but seems to have done the trick - Intellisense is now working.

CTRL + Shift + Space also working now…

I will not close this post until someone can tell me why this works/and if this ‘solution’ is going to cause problems because the Omnisharp:Use Modern Net says it does not support Unity?

1 Like

Hi, i seem to be having the same problem even though i did what you said with use modern net.

1 Like

Hi AxeOnee,

I am just a beginner student who googled some stuff and maybe stumbled on a solution…for me. I think it may depend on what version of Unity & VS Code you are using, but I am waiting for a Dev to respond to see if they can shine some light on it.

My very basic grasp of it is that it may have something to do with an update to Omnisharp which means Omnisharp is not loading correctly. You could try running a script
and then going to View - Output (in VS Code - see image). Does it say anything about ‘could not locate MSBuild instance to register Omnisharp’?

Example of error message I was getting before ‘solution’:

I would recommend posting a new topic with your problem - so they can respond directly to you.

Also, if the ‘Use Modern NET’ didn’t work for you I would suggest returning it to false - as that is the setting recommended by the Devs.

I can’t really help any more than that as I have only been doing this Unity/Coding stuff for a few weeks…

Good luck…and I’ll keep an eye on your post if you make a new topic. Googling the error message revealed a number of people experiencing problems with Intellisense not working in recent months.

1 Like

after some more googling, i just moved to visual studio community as its basically the same thing and intellisense works there .

1 Like

Okay - that’s good to know, just in case my VS Code stops behaving

Cheers

1 Like

I’m glad you managed to fix the problem. :slight_smile:

By the way, we got the information that did not work for you from the official VS Code website:

  1. In the VS Code Settings editor (Ctrl+,), uncheck the C# extension’s Omnisharp: Use Modern Net setting ( "omnisharp.useModernNet": false ).

If enabling omnisharp.useModernNet fixed the problem for you, keep it enabled. In the end, Unity does not use VS Code but the code. And the code is nothing but text. How you created the text is irrelevant as long as the code and the fileformat are correct. :slight_smile:


See also:

1 Like

Hi Nina,

Thanks for your help. I wasn’t making a criticism of GameDev, just pointing out to anyone following the post that what I was doing was contrary to the official guidance. I can’t remember why I tried it - I think it was a suggestion in some forum.

I still don’t understand why it works. Reading a bit more about the Omnisharp update (which occurred in May 2022) it states the following:

*.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 .
*> *

So…that seems to suggest it should work with Unity with the setting to false. But how would that solve the error I was getting regarding MSBuild not registering (because it couldn’t be located)? And…how come it works in Unity with the setting to true?

Also, how would I ‘restart Omnisharp’?

I was just hoping there might be a logical reason why it wasn’t working and now it is?

‘In the end, Unity does not use VS Code but the code.’ What about Omnisharp? What is the relationship between VSCode / Unity and Omnisharp? Could this be a clue? I have no idea and probably won’t understand your answer…:slight_smile:

I know…lots of questions…and maybe I don’t need to know at this stage, just be glad it works!

1 Like

A couple of days ago, a Unity employee posted the following in the official Unity forum:
http://forum.unity.com/threads/update-on-the-visual-studio-code-package.1302621

From what I read, Unity plans to disable the plugin in newer versions of Unity, and you’ll have to manually install it. They also mentioned that the package had not been updated for years. In the tech field, this information usually translates to “the technology is basically dead”. Of course, “usually” does not mean “always”.

I was just hoping there might be a logical reason why it wasn’t working and now it is?

There certainly is but unless you are eager to read ten thousands of lines of code, it’ll remain a mystery. The comment in the official Unity forum mentions that the VS Code Editor plugin is open source. It might be this one.

maybe I don’t need to know at this stage, just be glad it works!

That’s probably the best idea because we do not know the answer either and do not have time to debug any Unity packages, let along VS Code. :confused:


For information on Omnisharp, please refer to their official website. VS Code is just a script editor. It is not C#.

OmniSharp is a set of tooling, editor integrations and libraries that together create an ecosystem that allows you to have a great programming experience no matter what your editor and operating system of choice may be.

To restart Omnisharp, follow this instruction. I found it after I searched for “VS Code restart omnisharp” on the internet.

2 Likes

Hi Nina,

Thanks for the comprehensive reply. I read the discussion linked and it doesn’t sound like good news for VS Code and Unity.

This plugin was a result of one of our hackweek experiments by a few of our former employees.

…that is a bit of an eye opener (sounds very casually thrown together)

Also this:

Unfortunately, it’s never been fully functional and hasn’t received any updates for almost two years, bringing you an unstable coding experience.

As for reading thousands of lines of code…I’ll probably give that a miss :slight_smile: …one line is challenging enough at the moment.

I think I might just change to Virtual Studio Community Edition (and hope to heck that works for me :slight_smile: ). Not much point in getting used to VS Code if it’s not supported and doesn’t always work?

I’m assuming VSCE would be closest to VS Code, rather than Rider? I’m thinking I’d like my code to look as close to the lecturer’s as possible (later on, it won’t matter as much…if I get that far :slight_smile: ).

It’s somewhat consoling that there are definite issues arising with VS Code working with Unity, and it’s not just me.

I’ve learnt quite a bit through this, but I’m not sure how useful the post will be to other students? Maybe, just to conclude: try a few things and if it doesn’t work go for VSCE. Also…the internet is our friend (I should’ve just googled restart Omnisharp!).

Well…we sort of solved it

Many thanks,

Rob

1 Like

I usually recommend VS (Community Edition) because I have used it for many years to write C# code. It basically works out of the box, and, unlike Rider, VS is free for most people. It’s disadvantage is that it is very large compared to VS Code and it has got many tools you will probably never use.

Just to ensure there is no misunderstanding: VS Code is a good piece of software. I use it for web development and sometimes for quickly editing a C# script if I’m too lazy to open VS, which loads more slowly than VS Code.

Regarding Rider, if you know Rider or even have an active subscription, you may use it. From what I heard, that’s a good IDE, and it works well with Unity. The disadvantage is that it costs money. That’s why I usually do not recommend it unless students mention it themselves. We aim to make our courses accessible for as many people as possible, that’s why we try to use free software and assets if possible.

I’ve learnt quite a bit through this, but I’m not sure how useful the post will be to other students?

You are definitely not the only one experiencing problems with VS Code, so other students will very likely find this discussion helpful. I’m glad Unity finally addressed the problems with VS Code. Another student posted the link today in the Q&A section over on Udemy, and I copied the link and posted it here. :slight_smile:

1 Like

Thanks for your support and the tips.

1 Like

Privacy & Terms