How do I use Visual Studio Code to develop Unity3D projects in Ubuntu How do I use Visual Studio Code to develop Unity3D projects in Ubuntu linux linux

How do I use Visual Studio Code to develop Unity3D projects in Ubuntu


Please note that the following instructions contain commands that are specific for 18.04. Please check the sources if you have a different version of Ubuntu or Linux.


1. Install the C# extension for Visual Studio Code

C# Extension Screenshot


2. Install the "Debugger for Unity" extension for Visual Studio Code

Debugger for Unity Extension Screenshot

3. Install the latest version of "Mono"

Mono is an open source implementation of Microsoft's .NET Framework sponsored by Microsoft. Instructions for a repository installation:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EFecho "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.listsudo apt updatesudo apt install mono-devel

(Source). It also has instructions for 16.04 and 14.04.

4. Install dotnet

wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.debsudo dpkg -i packages-microsoft-prod.debsudo apt-get install apt-transport-httpssudo apt-get updatesudo apt-get install dotnet-sdk-2.1

(Source). It also has instructions for 16.04, 14.04 and others.

5. Open your project's folder with Visual Studio Code

Screen photo, opening project folder with Visual Studio Code

6. Set the "Unity Debugger" in Visual Studio Code

Select the debug view on the left and click the cogwheel.

Screenshot 1 from Github

In the drop down list select “Unity Debugger”. If you do not have Unity Debugger in the list, then you already have a .vscode/Launch.json file in your project that you must delete first.

Screenshot 2 from Github

You will now have a .vscode/Launch.json file in your Unity project folder and can select which Unity target you wish to debug.

Screenshot 3 from Github

(Source).