Search Unity

How to set up VSCode with Unity

Discussion in 'Getting Started' started by Echelon_33, Dec 31, 2021.

  1. Echelon_33

    Echelon_33

    Joined:
    Dec 31, 2021
    Posts:
    2
    I am a new user and have installed Unity 2020.3.25. I am assuming I need to associate this with VSCode to edit C# code in VSCode. I have therefore installed VSCode which appears to only install to my user/appdata... folder. I then try to set this as the location in Unity preferences, but when I then try to open the C# project from Unity (which I assume should open the code on the object I have selected and right clicked on) it throws up a bunch of Java errors as attached image (hopefully that worked). I then found something suggesting I need VSCode extensions but these would not download from the link I found. I thought I would check in case I am going down the wrong road and missing something basic. Anyone able to give some help?

    upload_2021-12-31_18-4-32.png

    Many thanks,

    Steve
     
  2. Echelon_33

    Echelon_33

    Joined:
    Dec 31, 2021
    Posts:
    2
    Okay, after watching many youtube videos showing how to install Unity and Visual Code and an SDK package and setting up paths, etc, and then browsing to this from the external tools in Unity and getting the above problem, I restarted googling Unity installation and setup guides and found one more different video, which showed using the Visual Studio Community 2019 package linked to from within Unity Hub. I have gone to Unity Hub, Installs, clicked on the settings icon to the right against my Unity package, selected Add Ons, selected Visual Studio Community 2019, installed, set to use this in the external tools in Unity, and it now works. I now double click my code object in Unity and it opens in this version of Visual Studio. I had to set some bits up like attaching to Unity, but all good now.

    I have no idea why Unity would not open up the other Visual Studio that I installed and gave the above error, but Visual Studio Community 2019 linked from Unity Hub appears to do everything I need and intelisense code completion is working, etc, so I think we are all good.