Unity Intellisense doesn't work(Solution1, Miscellaneous Files issue)
Asked Answered
P

3

7

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
Pontifical answered 26/10, 2020 at 21:6 Comment(2)
Does this answer your question? Unity Scripts edited in Visual studio don't provide autocompleteSofiasofie
check windows filepath length. Windows has limit of 256 characters, which might cause issuesLyckman
A
15

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.

Alkalize answered 26/10, 2020 at 21:55 Comment(4)
1- It's not in package manager. But I already downloaded it from Visual Studio Installer. Is it enough?Astyanax
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.Astyanax
@Ö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.Alkalize
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.Astyanax
M
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)

Munificent answered 23/3, 2021 at 17:27 Comment(0)
A
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/

Almoner answered 9/11, 2020 at 6:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.