Unity Scripts Edited in Visual Studio Don't Provide Autocomplete

Unity Scripts edited in Visual studio don't provide autocomplete

There is no auto-completion because the script says "Miscellaneous Files" instead of the of the name of the Project. Take a look at the image below that came from the video in your question:

Sample Image

The "Miscellaneous Files" message can happen for many reasons:

  1. It can happen when you open your Unity C# file from another folder instead of opening it from Unity Editor.

  2. This can also happen because Unity crashed while Visual Studio is still open therefore corrupting some files.

  3. It can happen because Unity was closed then re-opened but is no longer connected to Visual Studio. When Visual Studio is opened you get "Miscellaneous Files" and no auto-completion.

  4. This can happen when Visual Studio Tools for unity is not installed.

  5. When you create a script from Unity then quickly open it before Unity finish processing it or before the round icon animation stuff finish animating.


Most of the times, restarting Unity and Visual Studio should fix this.

I can't tell which one is causing the problem but I will cover the most likely solution to fix this.

Fix Part 1:

  1. Download and Install Visual Studio Tools for unity from this link. Do this while Unity and Visual Studio are both closed.

  2. From Unity Editor, go to EditPreferences... → External Tools. On the External Script Editor drop down menu, change that to Visual Studio 2015.

    Sample Image


Fix Part 2:

If newly created C# files are coming up as Miscellaneous then follow the instruction below:

  1. From Visual Studio, go to ToolsOptions...Tools for UnityMiscellaneous. Under Show connectivity icon, set it to true then restart Visual Studio.

    Sample Image

  2. When you re-start, connection icon should now be available in Visual Studio. Click it then choose the Unity instance to connect to. The red 'x' icon should now turn into a brown checkmark icon. Now, when you create a new C# file in Unity, it should open without saying Miscellaneous.

    Sample Image


Fix Part 3:

Still not fixed?

Re-import project then open C# Project.

  1. Close Visual Studio.

  2. From Unity, re-import project by going to AssetsReimport All.

    Sample Image

  3. Now, open the project in Visual Studio by going to AssetsOpen C# Project. This will reload the project and fix possible solution file problems.

    Sample Image


Fix Part 4:

Still not fixed?

Fix each C# file individually.

  1. Click on Show All Files icon.

    Sample Image

  2. Select the script that doesn't do auto-complete then right-click and select Include In Project.

    Sample Image


Fix Part 5:

Not fixed yet?

Credit goes to chrisvarnz for this particular solution which seems to have worked for multiple people.

  1. Close Visual Studio

  2. Go your project directory and delete all the generated Visual Studio files.

    These are the files extensions to delete:

    • .csproj
    • .user
    • .sln

    Example:

    Let's say that the name of your Project is called Target_Shoot, these are what the files to delete should look like:

    • Target_Shoot.csproj
    • Target_Shoot.Editor.csproj
    • Target_Shoot.Editor.csproj.user
    • Target_Shoot.Player.csproj
    • Target_Shoot.Player.csproj.user
    • Target_Shoot.sln

    Do not delete anything else.

  3. Double click on the script again from Unity which should generate new Visual Studio file then open Visual Studio. This may solve your problem.


Fix Part 6:

If not working, check if you are having this error:

The "GetReferenceNearestTargetFrameworkTask" task was not found

  1. Install Nuget PackageManager from here.

  2. Restart Visual Studio.

See this answer for more information.


Fix Part 7

Make sure all of the projects are loaded.
In Solution Explorer it should tell you # of # projects.
If all of the projects are not showing, right click on "Solution (# of # projects)" and click Load Projects.

The Unity Scripts edited in Visual studio don't provide autocomplete...2020

Your installation of Visual Studio is probably missing the Visual Studio Tools for Unity extension.
Try this installation guide: Get started with Visual Studio Tools for Unity

Unity Scripts edited in Visual studio don't provide autocomplete

There is no auto-completion because the script says "Miscellaneous Files" instead of the of the name of the Project. Take a look at the image below that came from the video in your question:

Sample Image

The "Miscellaneous Files" message can happen for many reasons:

  1. It can happen when you open your Unity C# file from another folder instead of opening it from Unity Editor.

  2. This can also happen because Unity crashed while Visual Studio is still open therefore corrupting some files.

  3. It can happen because Unity was closed then re-opened but is no longer connected to Visual Studio. When Visual Studio is opened you get "Miscellaneous Files" and no auto-completion.

  4. This can happen when Visual Studio Tools for unity is not installed.

  5. When you create a script from Unity then quickly open it before Unity finish processing it or before the round icon animation stuff finish animating.


Most of the times, restarting Unity and Visual Studio should fix this.

I can't tell which one is causing the problem but I will cover the most likely solution to fix this.

Fix Part 1:

  1. Download and Install Visual Studio Tools for unity from this link. Do this while Unity and Visual Studio are both closed.

  2. From Unity Editor, go to EditPreferences... → External Tools. On the External Script Editor drop down menu, change that to Visual Studio 2015.

    Sample Image


Fix Part 2:

If newly created C# files are coming up as Miscellaneous then follow the instruction below:

  1. From Visual Studio, go to ToolsOptions...Tools for UnityMiscellaneous. Under Show connectivity icon, set it to true then restart Visual Studio.

    Sample Image

  2. When you re-start, connection icon should now be available in Visual Studio. Click it then choose the Unity instance to connect to. The red 'x' icon should now turn into a brown checkmark icon. Now, when you create a new C# file in Unity, it should open without saying Miscellaneous.

    Sample Image


Fix Part 3:

Still not fixed?

Re-import project then open C# Project.

  1. Close Visual Studio.

  2. From Unity, re-import project by going to AssetsReimport All.

    Sample Image

  3. Now, open the project in Visual Studio by going to AssetsOpen C# Project. This will reload the project and fix possible solution file problems.

    Sample Image


Fix Part 4:

Still not fixed?

Fix each C# file individually.

  1. Click on Show All Files icon.

    Sample Image

  2. Select the script that doesn't do auto-complete then right-click and select Include In Project.

    Sample Image


Fix Part 5:

Not fixed yet?

Credit goes to chrisvarnz for this particular solution which seems to have worked for multiple people.

  1. Close Visual Studio

  2. Go your project directory and delete all the generated Visual Studio files.

    These are the files extensions to delete:

    • .csproj
    • .user
    • .sln

    Example:

    Let's say that the name of your Project is called Target_Shoot, these are what the files to delete should look like:

    • Target_Shoot.csproj
    • Target_Shoot.Editor.csproj
    • Target_Shoot.Editor.csproj.user
    • Target_Shoot.Player.csproj
    • Target_Shoot.Player.csproj.user
    • Target_Shoot.sln

    Do not delete anything else.

  3. Double click on the script again from Unity which should generate new Visual Studio file then open Visual Studio. This may solve your problem.


Fix Part 6:

If not working, check if you are having this error:

The "GetReferenceNearestTargetFrameworkTask" task was not found

  1. Install Nuget PackageManager from here.

  2. Restart Visual Studio.

See this answer for more information.


Fix Part 7

Make sure all of the projects are loaded.
In Solution Explorer it should tell you # of # projects.
If all of the projects are not showing, right click on "Solution (# of # projects)" and click Load Projects.

Unity Scripts edited in Visual studio don't provide autocomplete

There is no auto-completion because the script says "Miscellaneous Files" instead of the of the name of the Project. Take a look at the image below that came from the video in your question:

Sample Image

The "Miscellaneous Files" message can happen for many reasons:

  1. It can happen when you open your Unity C# file from another folder instead of opening it from Unity Editor.

  2. This can also happen because Unity crashed while Visual Studio is still open therefore corrupting some files.

  3. It can happen because Unity was closed then re-opened but is no longer connected to Visual Studio. When Visual Studio is opened you get "Miscellaneous Files" and no auto-completion.

  4. This can happen when Visual Studio Tools for unity is not installed.

  5. When you create a script from Unity then quickly open it before Unity finish processing it or before the round icon animation stuff finish animating.


Most of the times, restarting Unity and Visual Studio should fix this.

I can't tell which one is causing the problem but I will cover the most likely solution to fix this.

Fix Part 1:

  1. Download and Install Visual Studio Tools for unity from this link. Do this while Unity and Visual Studio are both closed.

  2. From Unity Editor, go to EditPreferences... → External Tools. On the External Script Editor drop down menu, change that to Visual Studio 2015.

    Sample Image


Fix Part 2:

If newly created C# files are coming up as Miscellaneous then follow the instruction below:

  1. From Visual Studio, go to ToolsOptions...Tools for UnityMiscellaneous. Under Show connectivity icon, set it to true then restart Visual Studio.

    Sample Image

  2. When you re-start, connection icon should now be available in Visual Studio. Click it then choose the Unity instance to connect to. The red 'x' icon should now turn into a brown checkmark icon. Now, when you create a new C# file in Unity, it should open without saying Miscellaneous.

    Sample Image


Fix Part 3:

Still not fixed?

Re-import project then open C# Project.

  1. Close Visual Studio.

  2. From Unity, re-import project by going to AssetsReimport All.

    Sample Image

  3. Now, open the project in Visual Studio by going to AssetsOpen C# Project. This will reload the project and fix possible solution file problems.

    Sample Image


Fix Part 4:

Still not fixed?

Fix each C# file individually.

  1. Click on Show All Files icon.

    Sample Image

  2. Select the script that doesn't do auto-complete then right-click and select Include In Project.

    Sample Image


Fix Part 5:

Not fixed yet?

Credit goes to chrisvarnz for this particular solution which seems to have worked for multiple people.

  1. Close Visual Studio

  2. Go your project directory and delete all the generated Visual Studio files.

    These are the files extensions to delete:

    • .csproj
    • .user
    • .sln

    Example:

    Let's say that the name of your Project is called Target_Shoot, these are what the files to delete should look like:

    • Target_Shoot.csproj
    • Target_Shoot.Editor.csproj
    • Target_Shoot.Editor.csproj.user
    • Target_Shoot.Player.csproj
    • Target_Shoot.Player.csproj.user
    • Target_Shoot.sln

    Do not delete anything else.

  3. Double click on the script again from Unity which should generate new Visual Studio file then open Visual Studio. This may solve your problem.


Fix Part 6:

If not working, check if you are having this error:

The "GetReferenceNearestTargetFrameworkTask" task was not found

  1. Install Nuget PackageManager from here.

  2. Restart Visual Studio.

See this answer for more information.


Fix Part 7

Make sure all of the projects are loaded.
In Solution Explorer it should tell you # of # projects.
If all of the projects are not showing, right click on "Solution (# of # projects)" and click Load Projects.

Autocomplete not working for VSCode with Unity

i had the same issue i solved it randomly so i will tell you things i tried:

  1. uncheck all options in unity>edit>preferences>external editor>generate .csharp. i checked all of them because a youtuber told me but then i saw that input system and cinemachine namespaces wont work so i unchecked them, now it works, it also helped on autocomplete.

  2. download unitydev extension package from vscode extensions, this package has all the needed documents and snippets and autocomplete assets.

  3. try to regenerate files and reset argument, change editor to something else and see if it wont work there too!

  4. most important downgrade vscodes pakcage in unity package manager. i think i used 1.2.0 and it worked.

Visual studio Autocomplete for Unity does not work

I managed and here is the solution. First I will post the errors I had so people having the same issues can find them more easily. If some step is not here you can also dm me bcs I had a big amount of errors.

Also link Unity to VS code if you haven't done so. It is in the comment above.

  1. Install homebrew if after installation it does not work in terminal, run export PATH=/opt/homebrew/bin/:${PATH} now it should work. However, whenever I close the terminal I need to do this command again.

  2. Install mono sdk either through mono-project.com (both channels for MacOS) or through homebrew

  3. Export mono to path: PATH=/Library/Frameworks/Mono.framework/Versions/Current/bin/:${PATH}

  4. Install dotnet sdk https://dotnet.microsoft.com/en-us/download - arm64 if you have M1 chip. Otherwise x64 for intel versions. Export dotnet to PATH if dotnet --help shows you errors (even though 'dotnet' command itself may work)

  5. In visual studio code install these extensions: C#, Unity code snippets - Kleber Silva, Unity snippets - Ycleptic Studios. Click on settings of C# extension (not VS code settings but settings of the actual c# extension), type 'useModernNet' and uncheck the box 'omnisharp.useModernNet'

I may have missed some steps but I will update them in less than a month because I will be reinstalling everything in my personal Mac.

**Also follow the steps here: https://code.visualstudio.com/docs/other/unity
**You can see all the export PATH locations in this folder /etc/paths.d - here should be mono-commands, dotnet and maybe more stuff
**If you need settings.json from VS code, it is located here: Library/Application\ Support/Code/User/settings.json



Related Topics



Leave a reply



Submit