简体   繁体   中英

Autocomplete for visual studio code not working for C#/Unity

I have just begun trying to learn C# with Unity. I'm following guides and tutorials. In these guides I see auto completions that my visual studio code is not showing me.

For example, in one video I see the following auto-completion:

在此处输入图像描述

On my own installation, I see the following:

在此处输入图像描述

Note that the auto-completion is not hinting Destroy . Other methods/functions such as GetComponent are also not auto-completed.

I believe that the correct folder is opened in VSC.

Visual studio code is set as my default editor in unity as per this question . I have installed the .Net Core Extension Pack , which includes the C# extension pack for VSC. What am I missing?

Enabling code completion (For recent versions of Unity)
If you are installing VS Code for the first time, you might be missing targeting packs required for Unity's code-completion (IntelliSense) in VS Code.
Targeting pack download links:
• Windows: .NET Framework 4.6 Targeting Pack
Download Link: https://www.microsoft.com/download/details.aspx?id=48136

• macOS: Download .NET SDK
Download link: https://dotnet.microsoft.com/download

Steps:

  1. Stop VS Code or Unity running.
  2. Download and install the targeting pack for your targeted framework version / preferred version from one of the above links.
  3. Start Unity.
  4. Create and/or open an existing script in VS Code, through Unity, and you should now see code completions.

Reference: https://code.visualstudio.com/docs/other/unity

install emmet plugin and use ctrl+space keys for auto-completion

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM