Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Code Completetion in Visual Studio Code not working at all

Discussion in 'Scripting' started by KokodokoGames, Sep 11, 2020.

  1. KokodokoGames

    KokodokoGames

    Joined:
    May 20, 2014
    Posts:
    40
    I have followed all the install instructions to get Visual Studio Code working for Unity on Mac. I have installed MONO, I have installed the VS Code package in the package manager, and I have installed the C# extension and the Unity Debugger extension in VS Code. But it still only works 25%

    Some generic monobehaviours are autocompleted, for example, everything that starts with ON.

    Code (CSharp):
    1. OnCollisionEnter2D(Collider2D other){}
    But at the same time, using undeclared variables or non-existing functions do NOT result in an error.
    Also, specific variable types do NOT get autocompletion. For example:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class LinkMoving : MonoBehaviour
    6. {
    7.     private Animator linkAnimator;
    8.  
    9.     void Start() {
    10.        test =getcomponent(); <-- THIS IS NOT AN ERROR
    11.  
    12.  
    13.         linkAnimator = GetComponent<Animator>();  
    14.         linkAnimator.SetFloat("Speed", 4);
    15.         linkAnimator.SetI... <-- THIS IS NOT AUTOMPLETED
    16.     }
    17.  
    18.     void Update() {
    19.        
    20.     }
    21. }
    22.  
    Strangely, I do get generic autocompletions. See the attached image! How can I get intellisense working correctly in VS Code on Mac?

    bug.png
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
  3. KokodokoGames

    KokodokoGames

    Joined:
    May 20, 2014
    Posts:
    40
    Thanks for the links! But I installed the VS Code package, I installed MONO, I regenerated the project files. I set the C# .NET scope to "global". I added ".net" to my path, I set the VS Code version back to 1.2 instead of 1.4.... and all the other things suggested in all those threads. The problem is, sooner or later intellisense always stops working. Also, for each and every new Unity project, I have to go through most of those steps again.

    I just wonder why it has to be so difficult to set up VS Code as a Unity editor. There doesn't seem to be serious support for it from either Microsoft or the Unity team.