Noam Riahi
Noam Riahi

Reputation: 173

AutoComplete does not work when I use VS code with Unity

I work with unity and the VS code autocomplete does not complete many unity objects and more.. I have 2 extensions on my VS: 1.C# for Visual Studio Code (powered by OmniSharp). 2.Unity Code Snippets. I'm using windows 10 and I looking for answers on the web for weeks, I tried to play with the settings, open new projects, reinstall VS CODE and nothing happen. also I saw that it's happen mostly to people with an old version of Unity but it's not my case..

I work with unity version 2021.1.15f1 personal and VSCODE 1.59.1

This is a picture that illustrates the situation enter image description here

Upvotes: 1

Views: 12819

Answers (6)

Noam Riahi
Noam Riahi

Reputation: 173

After years I let vs Code go and moved to Visual Studio 2022, I discovered it on the web by mistake the answer. the issue was that there was no .Net install, which is why the issue occurred. you can download it from here: https://dotnet.microsoft.com/en-us/download and it should fix the issue. even though I have found a solution, as a more experiment unity developer I suggest you today to move to Visual Studio 2022, it's much better

Upvotes: 0

Tug
Tug

Reputation: 15

This is an old post but I had the same issue and found a fix. I already implemented all of the steps listed in this post to no prevail.

I want to post my fix so that this may be able to help others.

My Solution:

  • I have a project using 202.3.48f1 (autocomplete worked fine).
  • I started a new project with 2021.3.32f1 and autocomplete did not work.
  • I searched for an answer but nothing worked.

Out of curiosity, I then closed out of the project that autocomplete wasn't working in, then opened up the other project where autocomplete was working to see if it was still working, and it was indeed working.

I then opened up my non-working project and bam, autocomplete started working.

All I had to do was open a different working project for the autocomplete to work again.

Hope that helps.

Upvotes: 1

Jason
Jason

Reputation: 1

I just updated my Visual Studio Editor version to 2.0.20. then I restart my script from unity, and it worked. Hope this video helps you: https://vionixstudio.com/2021/11/02/unity-visual-studio-code/#For_Unity_2021_or_newer

Upvotes: 0

Seb Thompson
Seb Thompson

Reputation: 1

Hey I think I found an answer for how to fix it after searching for ages.

Firstly, here's a link for a video explaining how to fix it: https://youtu.be/ihVAKiJdd40

what made it work for me was after going to edit-> preferences -> external tools and unchecking embedded packages and local packages, it worked for me

Upvotes: 0

Yamen Zaza
Yamen Zaza

Reputation: 1

Make sure that Visual Studio Code is selected as the default "External Script Editor" in your Unity preferences.

To do that in Unity, go to Edit->Preferences and then select "Visual Studio Code" as your preferred external script editor. Restart VSC afterwards.

Upvotes: 0

Namida Sai
Namida Sai

Reputation: 51

Apologies if you've tried everything there already, but following the instructions at this link have helped me get auto-complete for Unity set up in VS Code when I got started: https://code.visualstudio.com/docs/other/unity

One key aspect that I had missed originally was the Unity Script Editor set up section. IntelliSense only starts working after you have opened a script via the Unity Editor rather than straight in VS Code. It generates an Assembly-CSharp.csproj file at the root which is necessary for enabling the functionality.

Upvotes: 5

Related Questions