Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Resolved [VS Code]Classes not being detected when Unity&C# Dev Kit is enabled

Discussion in 'Code Editors & IDEs' started by billygamesinc, Aug 27, 2023.

  1. billygamesinc

    billygamesinc

    Joined:
    Dec 5, 2020
    Posts:
    318
    I have no idea how this happened last night but I'm currently running into this issue with VS Code Editor. Classes are not being detected whenever Unity & C# Dev Kit is enabled in Extensions. I have tried reinstalling VS Code as well as Unity but still running into the same issue.


    Fixed by installing the oldest version of VS Code.
     
    Last edited: Aug 28, 2023
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,767
    Which Unity version and which VSCode package? Unity's support for VSCode is gone and MS' new package is in preview.

    Btw, VS Community got just about one tenth of the issues of VSCode in case you want to get any real work done.
     
  3. billygamesinc

    billygamesinc

    Joined:
    Dec 5, 2020
    Posts:
    318
    I'm really set on using 2019.4.161f just because of the compile times. Visual Studio Code 1.81. I believe there is something going on with Omnisharp because Unity Intellisense isn't working either. I've tried reinstalling Unity as well as VSC.

    Also it just makes no sense why it would randomly stop working as it always did in the middle of the night..
     
  4. billygamesinc

    billygamesinc

    Joined:
    Dec 5, 2020
    Posts:
    318
    Code (CSharp):
    1. 2023-08-28 00:08:16.670 [warning] The project file 'c:\Users\bill\Mechanics\Assembly-CSharp.csproj' is in unsupported format (for example, a traditional .Net Framework project). It need be converted to new SDK style to work in C# Dev Kit.
    2. 2023-08-28 00:08:16.763 [info] Project system initialization finished. 0 project(s) are loaded, and 1 failed to load.
    3. 2023-08-28 00:08:16.772 [error] Failed to load project 'c:\Users\bill\Mechanics\Assembly-CSharp.csproj'. One or more errors occurred. (This project is not supported in C# Dev Kit.)
    4.  
    Found this error inside the output window.
     
  5. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,767
    Hmmm perhaps the version of VSCode you use is „too new“. Basically it cannot read 2019 style csproj anymore, at least seems like a possibility.

    In any case, if you want to build for mobile or webgl using 2019 is not a good idea due to min. required SDK versions for mobile, and generally outdated webgl tech. For PC it ought to be okay.
     
  6. sailro

    sailro

    Microsoft

    Joined:
    Jul 30, 2014
    Posts:
    167
    @billygamesinc You need to use the VS Editor package v2.0.20 in your Unity project, then properly select VSCode as your external editor.

    You are currently generating legacy-style csproj where VSCode+Unity&C# Dev Kit are requiring the new SDK-Style. Updating your VS code package will take care of that.
     
  7. billygamesinc

    billygamesinc

    Joined:
    Dec 5, 2020
    Posts:
    318
    I tried this method but it didn't work, I managed to fix it by reverting my C#DevKit to an older version.