How to install Unity3D on Ubuntu based Linux distros (Kubuntu, Xubuntu, POP_OS, Mint, Neon, Zorin, etc.).
This guide details how to install UnityHub, Unity, VS Code and how to get full C# support with IntelliSense and debugging.
Tested on Kubuntu 22.04.
Unity Hub won't run on Ubuntu newer than 20.04 because it depends on an outdated libssl. We need to manually install the package from 20.04:
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb
sudo dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb
Install Unity Hub - this is a shorter version of what the official guide does:
wget -O - https://hub.unity3d.com/linux/keys/public | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/unityhub.gpg
echo "deb https://hub.unity3d.com/linux/repos/deb stable main" | sudo tee /etc/apt/sources.list.d/unityhub.list
sudo apt update
sudo apt install unityhub
Launch Unity Hub, log in, install the desired Unity version and verify that it's working.
ℹ️ Note: Unity Hub is also available as an unofficial Flatpak. If all else fails or you're not on Ubuntu, it may be worth a shot.
Install VS Code from the official website using the provided .deb
. Snap version may work, but you'll likely have issues with Unity integration.
A complete and up-to-date Mono with msbuild is required instead of the default one available in Ubuntu, otherwise C# code completion won't work. The repo says it's for Ubuntu 20.04, but it works with 22.04 just fine. Uninstall the built in Mono first, if you have it installed.
wget -O - "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA6A19B38D3D831EF" | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/mono-official-stable.gpg
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt install mono-complete
You'll also need DotNET Core for debugging and using OmniSharp without errors. Seems quite reduntant, but I couldn't get it to work without it.
sudo apt install dotnet6
Install C# for Visual Studio Code (powered by OmniSharp) from within the VS Code extensions panel.
Go to settings (Ctrl + ,), search for "Use modern Net" and uncheck - this is required for Unity projects and this will use the Mono we installed. Alternatively you can add "omnisharp.useModernNet": false
to settings.json
.
Restart VS Code. You'll need to set the correct project for code completion and debugging, but there's an easier way - see the next section.
Go to Edit > Preferences > External Tools > External Script Editor and select your VS Code instance. Mine was called "Visual Studio Code Insiders (usr/bin/code)". Double click any .cs file in Unity to open the file in VS and ensure the correct project is loaded.
Optional: To cut down compilation time significantly when entering play mode or changing the code go to Edit > Project Settings > Editor > Enter Play Mode Options, tick the box, you can leave the rest unchecked or customize to your needs.
The official VS Code debugger is unmaintained and broken. There's an unofficial Debugger for Unity, which worked for me. Instead of using the outlined setup, which seems to be for an older VS Code, you just need to press Ctrl+Shift+P and run "Unity Attach Debugger". Don't forget to turn on the debug mode in Unity in the lower right corner (the bug icon).
- VSync is ignored in the Game View - I'm using
if (Application.isEditor) Application.targetFrameRate = 60;
as a workaround - popups like color pickers or dropdown lists often don't open under the correct control, but in the top left corner of the editor - a small annoyance, probably only KDE specific?
i am using zed not vscode