6

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:

enter image description here

On my own installation, I see the following:

enter image description here

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?

3
  • I think you are missing some namespaces Commented Aug 8, 2020 at 10:00
  • I believe I'm using the same name spaces as in the example video. Would you know which name space I'm missing? Commented Aug 8, 2020 at 10:03
  • I would reinstall Unity and let it install VS automatically. It should work then. Commented Aug 8, 2020 at 10:10

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

1 Comment

i have intellisense but i dont get the same auto completes as them and i turned off auto completes from unimported namespaces because it kept changing transform to cryptoapitransform but i dont know how to get the other auto completes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.