Fixing Visual Studio’s IntelliSense (auto-complete) in Unity

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
One of the biggest perks of using Microsoft  Visual Studio to write your Unity Scripts   is Intellisense— a code completion aid that  offers suggestions as you write your code,   and contextually presents you with  information about the classes,   properties, and methods that you are working with. Given Unity's enormous scripting API, IntelliSense is a tremendously helpful feature especially for coders who are just starting out with Unity. For the most part, IntelliSense is automatically  set up and linked to Unity's API when you install it with the Unity Editor but sometimes, that's just not the case. So if you've got both Unity and Visual Studio set up, but find that IntelliSense is still not offering Unity API suggestions, then this guide is for you. There can be many reasons why IntelliSense fails to work properly on your device. We assume that you've already scoured the  internet a fair bit before stumbling on this video.  You can look through the timestamps in the description below So if you've already tried some of the solutions that we have, you can skip right through them. Also, check out the post on our blog. We might update it with any new  fixes to this problem in the future. For IntelliSense to detect and work with  Unity's API, visual studio needs to: 1. Be linked to the Unity Editor, and; 2. Have the appropriate extensions installed. If you have installed Visual Studio via Unity Hub, this would have been automatically set up but it is not always the case. Due to the bevy of ways which you can install  Unity and Visual Studio, Misconfigurations can happen and you might end up with Visual Studio not integrating itself into Unity. To check if intellisense is properly set up open any script  from the unity editor and look out for two things   Look at the top-left dropdown. This is what it  looks like if everything is working correctly  . If IntelliSense isn't set up it should say  miscellaneous files instead. Try declaring a unity variable like a GameObject. If IntelliSense is properly set up, you should see an autocomplete suggestion for you before you finish typing. And if you don't see any autocomplete it means it's not set up. So if IntelliSense isn't working for you what should you do? 2a. Open your scripts from Unity. Before you try anything else from here, First, make sure that your scripts are opened from within Unity. If it doesn't work, continue on. 2b. Setting unity's external script editor From the Unity Editor, access the Preferences  window from Edit> Preferences. Then click on the External Tools tab. Set the External Script Editor of the version of Visual Studio that you installed. If it doesn't appear in the drop-down, then you have to use the browse option. Usually you can find it in C:\Program Files (x86)\Microsoft Visual Studio\The Year\Community\Common7\IDE\devenv.exe if you're using Windows. Now restart Visual Studio and see if Intellisense now works. If it still doesn't work, you might be missing... 2b. Visual Studio Tools for Unity. To install this, go to Visual Studio, go to Tools > Get Tools  and Features. You'll need admin perms to open this window. Once the installer is open, go to  workloads and find "Game Development with Unity" Check it, and then click on the modify button on the bottom right corner to begin installation. A pop-up may ask you to close certain processes before beginning installation. If this happens, close your Visual Studio Project in the Unity Editor Application. When installation completes, restart both Unity and Visual Studio, then check to see if Intellisense  now works. If IntelliSense still refuses to work, you can open the Unity Editor and head to Edit > Project Settings, and access the Player  tab. Scroll down to the other settings sub-tab, and find the API Compatibility Level dropdown under the Configuration heading.   You want to set the API Compatibility Level to a different option and see which is the one that works for your device. 2e. Regenerating your Unity Project files If the previous solutions that we've proposed did not work for you,   it could be a problem with your Unity Project  itself. So before we do this, let's back up our Unity Project as we are deleting some essential project files and letting Unity regenerate them. Once you've done that, close both Visual Studio and Unity on your device.   Remove all .sln and .csproj files in your Unity project folder.   Remove the .vs and Library folders in your Unity Project folder   Reopen the project in Unity, then go to Assets > Open C# Project to open Visual Studio. If you still have problems with getting it to work, you might want to check out our blog post We'll continue to update it as we  find more fixes. That's it for now!
Info
Channel: Terresquall
Views: 6,907
Rating: undefined out of 5
Keywords: intellisense, unity, visual studio, yt:cc=on
Id: rZMTY1iU6wo
Channel Id: undefined
Length: 5min 38sec (338 seconds)
Published: Mon Jun 14 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.