Kubuntu, the KDE flavour of Ubuntu, seems to work very well out of the box when installed on a new machine, needing very little configuration. One instance where you need to take that extra step is to allow taps on a laptop touchpad to be interpreted as clicks. For some reason I can’t imagine, this is not enabled by default.
Note: I’m using Kubuntu 20.04 LTS with KDE Plasma 5.18.5.
To enable this, you need to go into System Settings -> Input Devices -> Touchpad. You can reach the Touchpad settings directly by searching for “touchpad” in the search box (top-left in System Settings).
Once in the Touchpad settings, all you need to do is enable the “Tap-to-click” option. Once this is enabled, there are additional settings you can customise, but there’s typically no need to change them.
So you’ve set up Unity3D on Linux, but now you need a good text editor to write your scripts. In that case, you can consider using Visual Studio Code (VS Code for short), a cross-platform text editor from Microsoft. VS Code has become hugely popular for web development, but its versatility means that it can also be used for programming in languages such as C#, Python, Go, etc.
Note that I am using Linux Kubuntu 20.04 (LTS) and Unity3D 2020.3.15f2 (LTS).
Alternatively, you can download and install a .deb or .rpm package of you prefer. See the documentation for details.
Configuring the External Editor in Unity3D
Next, we’ll configure Unity3D to use VS Code as its external editor for scripts.
First, you’ll need to have the “Visual Studio Code Editor” package installed. This is set up for you when you create a new project, but you can double-check via the Window menu and then Package Manager:
With that in place, go to the Edit menu and then Preferences… and switch to the External Tools tab. Click the dropdown next to the “External Script Editor” setting and then Browse… for the VS Code executable. If you don’t know where it is, use the following command in a terminal to locate it. In my case it’s at /snap/bin/code.
Now, if you create a C# script in Unity3D and open it, it should open in VS Code.
Configuring VS Code for Unity3D
You can now write C# scripts for Unity3D in VS Code and you have syntax highlighting to help you. However, Intellisense — the helpful suggestions that pop up e.g. when you try to access an object’s properties — doesn’t work yet. You also don’t get any indication of C# syntax errors. Let’s fix this so that we can write Unity3D scripts in a comfortable environment.
Next, head to the Mono Download page, and follow the first set of instructions to add the Mono repository to your system. Then, for the second step, install mono-complete instead of mono-devel as shown below. (Note: don’t run the following command before first setting up the Mono repository. The version coming from the Ubuntu repositories doesn’t seem to play well with VS Code and Unity3D.)
sudo apt-get install mono-complete
Then, in VS Code, go to the Extensions tab on the left, search for “C#”, and install the first extension that comes up:
Open up settings via File menu -> Preferences -> Settings (or Ctrl+, (control comma)) and search for “Omnisharp: Use Global Mono“, then set its value to “always”. Click “Restart Omnisharp” from the notification that appears at the bottom-right. You can also restart Omnisharp at any time by pressing Ctrl+Shift+P and selecting “OmniSharp: Restart OmniSharp”.
Still No Intellisense?
The above steps are usually enough to get Intellisense working, but as I’m writing this right now, it doesn’t seem to work. To fix this, I had to downgrade the C# extension in VS Code, as follows:
Go into the Extensions tab in VS Code.
Locate the C# extension by OmniSharp.
Click the small arrow next to the “Uninstall” button.
Select “Install Another Version…”
In my case, the latest version (1.23.14) was released just 3 days ago. I went for an older version that had been around for a couple of months (1.23.12).
Click the “Reload Required” button.
Watch the Output and wait for OmniSharp to finish downloading and installing.
VS Code should now provide Intellisense as you type, and you should also see syntax errors called out via both a squiggly red underline and in the Problems window below.
You should now be all set up. Happy game development!
"You don't learn to walk by following rules. You learn by doing, and by falling over." — Richard Branson