Visual studio code auto-complete

62,602

Solution 1

Maybe too late, but for future comers ...

There is an extension now for visual studio code called MonoBehaviour Snippets by Rachod Petchpho.

Press Ctrl+shift+x in the IDE to open extensions panel then search for MonoBehaviour Snippets, install and reload the IDE, now you will find all the autocomplete for the function names and objects just like MonoDevelop.

Solution 2

I had the same situation and I bang my head to the wall for days. There was no solution on the net as there are few people using Unity on linux with Visual Studio Code. I finally removed mono and went to their site and downloaded the Visual Studio build (even though we use Visual Studio Code). Then volaaa. Auto complete and suggestions related to Unity functions were there. Of course after installing the necessary extensions.

https://www.mono-project.com/download/vs/

Solution 3

I had the same problem with Unity + VS Code combo.

I have found an extension called Unity CodeSnippets

I highly recommend to download it. This is much better than any of other snippets collection for VSCode.

Solution 4

Intellisense (Autocompletion) is a pure workflow of .Net Environment. So, you need to have .Net 'Developer pack' (not Runtime) installed on your system as it installs all three necessary components below:

  1. .Net framework
  2. .Net Target pack
  3. .net SDK

reference link: https://dotnet.microsoft.com/download/visual-studio-sdks

It is directly installed to a system admin-accessible path, so no need setting it up. Now, you have to tell VS Code which .Net version to use (whichever you have installed). Your Unity project will have these two files in the root directory:

  1. Assembly-CSharp.cs
  2. Assembly-CSharp-Editor.cs

In these both files search for line (probably 16):

<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>

Edit version that you had just installed (I had 4.8). Then reopen VS Code. Now everything should work fine.

Solution 5

https://forum.unity.com/threads/cant-get-vscode-to-work-properly-with-unity.538224/

there are people that found a workaround. unityoracle user said: "This issue is that Unity Editor expects the file used to launch VSCode to have a specific name. " and: "Specifically, creating a symlink named "code" that opens VSCode fixed this issue"

Share:
62,602
Abdou023
Author by

Abdou023

Updated on July 14, 2022

Comments

  • Abdou023
    Abdou023 almost 2 years

    I have just downloaded unity and saw that now it supports Visual studio code, I downloaded it and made it the default editor.

    After trying to edit a script, it prompted me to download c# extension and I did, but there is no auto-complete for unity functions. How can I get that? I'm on Mac. Any help is appreciated.

  • Abdou023
    Abdou023 over 7 years
    Thanks, but it doesn't seem like unity actually supports VSC or even has an official extension for it. For now I will just stick with Mono.
  • Chris Hawkes
    Chris Hawkes almost 5 years
    Awesome project in place of a similar that automatically injected massive commenting everywhere. This is a great tool! thank you for sharing!
  • Veda
    Veda over 4 years
    Worked for me on Ubuntu 16.04
  • Sunny Chow
    Sunny Chow over 4 years
    it helps in my Mac too
  • Daniel Memije
    Daniel Memije over 4 years
    Worked on Fedora 31
  • Andrei
    Andrei about 4 years
    What helped from there was Assets -> Open C# project. I also installed Mono (also a recommendation there)
  • David Hansen
    David Hansen almost 3 years
    This worked for me, but I also had to go to Edit > Preferences > External Tools in Unity and set the external script editor to Visual Studio Code, then I clicked "regenerate project files" to get Assembly-CSharp.csproj to show up in my project folder.