El_Merendero
El_Merendero

Reputation: 709

Visual Studio Code - C# extension does not recognize the Unity classes

I'm trying to set up my VS Code in order to properly work with a Unity project using Windows 10 as OS. This is what I've done:

At this point I imported my project root folder in the VS Code workspace but the IntelliSense function doesn't work. So I read this guide and then I ran:

dotnet new console
dotnet run

Now it seems that the IntelliSense works but VS Code doesn't recognize the Unity classes and, for this reason, my project is full of errors. Is there a way to fix it or to import the UnityEngine package?

Upvotes: 1

Views: 4236

Answers (1)

user12531529
user12531529

Reputation:

You don't need .Net for working with Unity projects. Just install Microsoft .Net Framework 4.7.1 SDK to make your C# Omnisharp VS Code extension work properly. Nothing else should be done, just open your project and everything should be OK.

See your VS Code OUTPUT->Omnisharp Log, it'll ask you to install .Net Framework SDK

Also, you need to open your project with Unity Editor at least once, otherwise you'll get a lot of The name 'gameObject' does not exist in the current context [Assembly-CSharp]csharp(CS0103), The type or namespace name 'GameObject' could not be found (are you missing a using directive or an assembly reference?) [Assembly-CSharp]csharp(CS0246) and so on erros in your VS Code even for a workable project.

Upvotes: 1

Related Questions