6

I can't use Intellisense in visual studio. When I double-click a c# file in Unity, visual studio shows up. But on top, I can't see my project name. Instead there is "Miscellaneous Files". So Intellisense doesn't work.

What I've already tried:

1

I opened the external script editor, it was default "open by file extension". I changed it to vs 2017 and vs 2019. But this time when I open my scripts from Unity, it doesn't open. So I changed it back to "open by file extension".

2

I controlled the visual studio tool for Unity. I already downloaded it.

3

In solution explorer, right clicked and added "RegularFight.sln" again. Nothing changed but then clicked folder view. And I can use Intellisense. But this is temporary. I have to do this everytime.

4

Show the project on explorer. There is "RegularFight.sln" which is my projects name and which is 1KB. So it means it's an empty solution. And there is "Assembly-CSharp.csproj" it's 45KB and it includes my scripts. When I open it I can use Intellisense.

So I want to use Intellisense when I open my script from Unity. How can I fix it?

Unity version: 2020.1.7f1
2

3 Answers 3

13

Seeing "Miscellaneous Files" means that your Visual Studio is not properly synced with Unity. You're seeing just a plain old C# file by itself, not a file that is associated with a Project.

The steps to rectify are usually:

  1. Make sure "Visual Studio Editor" ( a.k.a. Visual Studio Tools for Unity) is installed in Package Manager.
  2. Go to Edit > Preferences > External Tools and make sure that Visual Studio is set as your "External Script Editor".
  3. Restart both Unity and Visual Studio, or even your whole machine to make sure.

Here's what you should be seeing (or something similar depending on your Unity version).

Package Manager and the Visual Studio Editor package

And your preferences should look similar to this:

enter image description here

After making sure all these items are in place, 9 times out of 10, that will resolve your issue.

You also don't want to be adding or touching .SLN (solution files) directly. Unity will add all of the projects and references required to the solution file. Any changes you make will generally be overwritten by Unity.

4
  • 1- It's not in package manager. But I already downloaded it from Visual Studio Installer. Is it enough? Oct 27, 2020 at 8:33
  • 2- As I said above if I choose vs 2019 or 2017 in External Script Editor, then I can't open my scripts. No matter how many times I click, it doesn't open vs. Oct 27, 2020 at 8:35
  • @ÖmerFarukSarıışık you might actually need to uninstall the previous version - the one you installed from the Visual Studio Installer. Once you've done that, try and find it in the Package Manager. As long as you're using a moderately modern version of Unity editor, you should be seeing similar options to the one in the edited answer. Oct 27, 2020 at 9:32
  • Well, I uninstalled it from vs installer. Then, in package manager I updated visual studio editor. But there was no green verification mark like yours. Finally choose the vs 2019 and 2017 in external script editor. Restart the pc. But still the same. I can't even open my scripts from unity. If I don't choose vs 2017 or 2019 from external script editor, I can open scripts but no intellisense. Oct 27, 2020 at 11:26
1

After doing all the normal steps, try reloading the project in Visual Studio, within the Solution Explorer. (if you're able to open VS, of course)

0

Try following the steps here and see if it resolves your issue. It could be .NET API compatibility level issues if your Unity Library extension seems to be installed and working fine.

https://blog.terresquall.com/2020/11/getting-visual-studios-intellisense-code-autocomplete-to-work-for-unity/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.