Visual Studio Unity Intellisense



Many users may face a common issue when IntelliSense is not working in Visual Studio. Here are some solutions which can be tried to solve the problem. IntelliSense might be unavailable. Set environment variable TRACEDESIGNTIME = true and restart Visual Studio to investigate. I try to disable IntelliSense but it doesn't work,i find maybe it is caused by the project being moved,so i want to get some suggets here. Expected behavior. For IntelliSense to detect and work with Unity’s API, Visual Studio needs to: Be linked to the Unity Editor, and; Have the appropriate extensions installed (read further to find out what they are) If you’ve installed Visual Studio via Unity Hub, this can have been automatically set up, but not always. 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. This has been bugging me for years. I finally sat down and settled things by staring Unity and vscode deep in its eyes. Also giving them blue eyes.

  1. Visual Studio Unity Autocomplete Not Working
  2. Visual Studio Code Unity Intellisense
-->

IntelliSense is a code-completion aid that includes a number of features: List Members, Parameter Info, Quick Info, and Complete Word. These features help you to learn more about the code you're using, keep track of the parameters you're typing, and add calls to properties and methods with only a few keystrokes.

Many aspects of IntelliSense are language-specific. For more information about IntelliSense for different languages, see the topics listed in the See also section.

List Members

A list of valid members from a type (or namespace) appears after you type a trigger character (for example, a period (.) in managed code or :: in C++). If you continue typing characters, the list is filtered to include only the members that begin with those characters or where the beginning of any word within the name starts with those characters. IntelliSense also performs 'camel case' matching, so you can just type the first letter of each camel-cased word in the member name to see the matches.

After selecting an item, you can insert it into your code by pressing Tab or by typing a space. If you select an item and type a period, the item appears followed by the period, which brings up another member list. When you select an item but before you insert it, you get Quick Info for the item.

In the member list, the icon to the left represents the type of the member, such as namespace, class, function, or variable. For a list of icons, see Class View and Object Browser icons. The list may be quite long, so you can press PgUp and PgDn to move up or down in the list.

You can invoke the List Members feature manually by typing Ctrl+J, choosing Edit > IntelliSense > List Members, or by choosing the List Members button on the editor toolbar. When it is invoked on a blank line or outside a recognizable scope, the list displays symbols in the global namespace.

To turn List Members off by default (so that it does not appear unless specifically invoked), go to Tools > Options > All Languages and deselect Auto list members. If you want to turn off List Members only for a specific language, go to the General settings for that language.

You can also change to suggestion mode, in which only the text you type is inserted into the code. For example, if you enter an identifier that is not in the list and press Tab, in completion mode the entry would replace the typed identifier. To toggle between completion mode and suggestion mode, press Ctrl+Alt+Space, or choose Edit > IntelliSense > Toggle Completion Mode.

Visual

Parameter Info

Parameter Info gives you information about the number, names, and types of parameters required by a method, attribute generic type parameter (in C#), or template (in C++).

Intellisense

The parameter in bold indicates the next parameter that is required as you type the function. For overloaded functions, you can use the Up and Down arrow keys to view alternative parameter information for the function overloads.

When you annotate functions and parameters with XML Documentation comments, the comments will display as Parameter Info. For more information, see Supply XML code comments.

You can manually invoke Parameter Info by choosing Edit > IntelliSense > Parameter Info, by pressing Ctrl+Shift+Space, or by choosing the Parameter Info button on the editor toolbar.

Quick Info

Quick Info displays the complete declaration for any identifier in your code.

When you select a member from the List Members box, Quick Info also appears.

You can manually invoke Quick Info by choosing Edit > IntelliSense > Quick Info, by pressing Ctrl+K, Ctrl+I, or by choosing the Quick Info button on the editor toolbar.

If a function is overloaded, IntelliSense may not display information for all forms of the overload.

You can turn Quick Info off for C++ code by navigating to Tools > Options > Text Editor > C/C++ > Advanced, and setting Auto Quick Info to false.

Unity

Complete Word

Complete Word completes the rest of a variable, command, or function name after you have entered enough characters to disambiguate the term. You can invoke Complete Word by choosing Edit > IntelliSense > Complete Word, by pressing Ctrl+Space, or by choosing the Complete Word button on the editor toolbar.

IntelliSense options

IntelliSense options are on by default. To turn them off, choose Tools > Options > Text Editor and deselect Parameter information or Auto list members if you do not want the List Members feature.

IntelliSense icons

The icons in IntelliSense can convey additional meaning with icon modifiers. These are stars, hearts, and locks layered on top of the object's icon that convey protected, internal, or private, respectively.

Visual Studio Unity Intellisense
IconAccessibilityDescription
Public classAccess is not restricted.
Protected classAccess is limited to the containing class or types derived from the containing class.
Protected internal classAccess is limited to the current assembly or types derived from the containing class.
Internal classAccess is limited to the current assembly.
Private classAccess is limited to the containing class or types derived from the containing class within the current assembly. (Available since C# 7.2.)

Troubleshoot IntelliSense

The IntelliSense options may not work as you expect in certain cases.

The cursor is below a code error. You might not be able to use IntelliSense if an incomplete function or other error exists in the code above the cursor because IntelliSense might not be able to parse the code elements. You can resolve this problem by commenting out the applicable code.

The cursor is in a code comment. You can't use IntelliSense if the cursor is in a comment in your source file.

The cursor is in a string literal. You can't use IntelliSense if the cursor is in the quotation marks around a string literal, as in the following example:

The automatic options are turned off. By default, IntelliSense works automatically, but you can disable it. Even if automatic statement completion is disabled, you can invoke an IntelliSense feature.

See also

The end goal here is to have Unity3D and Visual Studio Code installed on a Debian 10 Linux system with Intellisense completionsworking for Unity code.

You should be able to type the start of a Unity name like GameObject and see the completion:

I mostly followed @nosuchstudio’s guide for Ubuntu 18.04 LTS but added some extra details and confirmed Debian 10 compatability.

There are four things to install and configure:

  1. Unity Hub
  2. Visual Studio Code
  3. .NET Core 3.1
  4. Mono

1. Install Unity Hub

Download the AppImage from here. Move itto a convenient location and set it executable:

2. Install Visual Studio Code

Download the 64bit deb of Visual Studio Code and install it:

Make sure that you have the C# extension installed:

Also make sure that under Unity3D’s Edit/Preferences/External Tools menu, you have Visual Studio Code selected(not Open by file extension) and all the checkboxes ticked:

Visual

3. Install .NET Core 3.1

Debian 10 can run .NET Core 3.1 (see these notes).

Following the detailed installation steps:

4. Install Mono

Follow the Debian instructions:

Test the integration and Intellisense

Create a new Unity3D project and add a C# script in your Assets folder:

If you have a script attached to a game object, do NOT click the Edit script menu item as thiswill load the invidivual file. Instead, open the script via the Assets window and selectOpen C# Project:

Intellisense won’t work until the project has been compiled. You’ll see lots of mono processes:

Visual Studio Unity Autocomplete Not Working

Once everything has compiled, test out Intellisense completions:

Visual Studio Code Unity Intellisense

Also note that the left panel has lots of Unity components, not just the C# file. This indicates that you haveopened the C# project, not an individual file.