4

I work in Ubuntu 16.04 and I have Unity3d installed. I want Visual Studio Code to be my default script editor within Unity3d.

Please watch this 30 seconds video and don't confuse Unity3d (the world-leading creation engine) with Unity (the default desktop environment of Ubuntu 16).

I put the shortcut of VSC, but I have to put an argument (e.g. : "$(File)"). I copy-pasted the location of the VSC, but when I try to open a script (e.g. TriggerChecker.cs), VSC opens but the script doesn't appear.

The only way to edit the script is to open VSC and add the project folder, the I have to search the script in the whole project folder. Watch this video to see how I need to search the script. I want to make Unity3d to show directly the script, because when my project will become bigger, it would be easier for me to edit scripts without searching them. As far as now, I only have one argument for VSC ("$(File)") that is ("$(/usr/share/code/code --unity-launch )"). This is the path to VSC's shortcut.

Could you help me solve this issue?

  • Are you still on? – Matthew Mar 28 '18 at 7:03
6

Visual Studio Code for Linux

  • Download the latest version from the official page.
  • Install VSC and the dependencies via the command line:

    sudo dpkg -i code*.deb
    sudo apt install -f
    
  • The binary of VSC is /usr/share/code/code, but wen we execute code in the command line is executed the startup script /usr/bin/code and we will use it in the latest section.

Unity3d for Linux

  • Unity3d for Linux is Beta version at the moment and more details could be found in Unity Blog. The latest version can be downloaded from (source of the information): this link.

  • Install Unity3d and the dependencies via the command line:

    sudo dpkg -i unity*.deb
    sudo apt install -f
    

Set Visual Studio Code as default script editor in Unity3d

  • Open Unity3d. In the Edit menu choose Preferences.

  • In Unity Preferences choose External Tools (left side).

  • Click on the button next to the ticket External Tools Editor and choose Browse.

  • Navigate to the file /usr/bin/code and click on Open.

  • THE KEY STEP: For External Script Editor Args fill $(File) - without quote marks!

    I found that (bug) the quote marks, that are there by default, are passed as characters, appended to the file name, thus VSC (the external editor) opens a file that currently doesn't exist.

  • Close Unity Preferences. That's it.

enter image description here

  • if you cant find the location of vscode, open terminal and write: $ whereis vscode – Arthur Zennig Jul 27 '18 at 21:16
  • 1
    May also be in /snap/bin/code if you used the software installer to install vscode – Harry Mar 13 '19 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.