Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Errors in VSCode that are not in Unity

Discussion in 'Code Editors & IDEs' started by cjddmut, May 16, 2022.

  1. cjddmut

    cjddmut

    Joined:
    Nov 19, 2012
    Posts:
    179
    It's pretty simple, VSCode is reporting a LOT of errors that aren't reflected in Unity and does actually compile just fine. Below is an example of a script that is actually fine but VSCode is none too happy with.

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class ErrorInVSCode : MonoBehaviour
    4. {
    5.     public int variable = default;
    6. }
    7.  
    upload_2022-5-16_13-56-59.png

    This isn't the only example of something it's not happy with but just a simple one. Trying to use VSCode on my way worse laptop so hoping to find a solution as it's a little trickier to work when it thinks an entire file isn't going to compile.

    I have followed the tutorial for how to use visual studio code with unity so as far as I know I should be in a good position.

    Unity: 2020.3.17f1
    Visual Studio Code Editor: 1.2.5
    C# for Visual Studio Code (powered by OmniSharp): 1.5.2

    Thanks!