Coder Perfect

Autocompletability is not available in Unity scripts written with Visual Studio.

Problem

C# Unity scripts open in Visual Studio when I want to change them. It’s supposed to auto-complete all Unity-related code, however it doesn’t work.

The missing functionality can be seen here:

The transform object does not, as you can see, open the autocomplete menu.

Asked by CorbenDalas

Solution #1

Because the script says “Miscellaneous Files” instead of the Project’s name, there is no auto-completion. Take a look at the image below, which was taken from the video you asked about:

The notification “Miscellaneous Files” can appear for a variety of reasons:

Restarting Unity and Visual Studio should usually solve the problem.

I’m not sure which one is causing the issue, but I’ll go over the most likely solution.

Fix Part 1:

Fix Part 2:

If your freshly created C# files appear as Miscellaneous, follow the steps below:

Fix Part 3:

Still not fixed?

After that, re-import the project and open the C# project.

Fix Part 4:

Still not fixed?

Each C# file should be fixed separately.

Fix Part 5:

Not fixed yet?

Chrisvarnz deserves credit for this approach, which appears to have worked for a number of folks.

Fix Part 6:

Whether that doesn’t work, see if you’re getting the following error:

For further information, see this response.

Answered by Programmer

Solution #2

Try this,

If Visual Studio is already open, go to it and it will prompt you to reload the project. The project should be reloaded. If it doesn’t work, close Visual Studio. Now open the cs file in Unity Editor, and everything should be OK.

Answered by Junaid Pathan

Solution #3

I discovered a more convenient technique to solve this problem:

This will break Unity’s and Visual Studio’s synchronization in some way.

Visual Studio will issue a warning the next time it reloads the project. Simply select “Discard” from the drop-down menu.

Answered by Michaƫl Nguyen

Solution #4

If all of the above hasn’t worked, try the following: You should have upgraded Visual Studio.

To access the external script editor, go to Unity > Edit> Preferences >External tools> external script editor. I had not selected “visual studio” as an external script editor, hence it was not functioning for me. It started working as soon as I chose this and double-clicked on the c# file from Unity.

I hope it is also beneficial to you.

Answered by yOhaan

Solution #5

In Visual Studio, unload and reload the project:

Fixed!

After many runs into the problem, I found this approach to be the best (easiest).

Source: https://alexdunn.org/2017/04/26/xamarin-tips-fixing-the-highlighting-drop-in-your-xamarin-android-projects/

Answered by Xonatron

Post is based on https://stackoverflow.com/questions/42597501/unity-scripts-edited-in-visual-studio-dont-provide-autocomplete