I recently began testing out TeamCity on an Azure VM and liked it so much that I installed and configured it on my personal application server. The Azure VM ran Windows Server and so I was able to just download Unity Hub and install the version of Unity my team’s project was using (it wasn’t the latest one, so had to use the Unity Download Archive to get it and install within Unity Hub).
This worked out pretty well, the only thing was that the Azure VM was expensive (luckily was using trial credit) hence the move to my application server.
My application server runs Linux headless (no GUI), Unity has no headless installation option. You might start to see the problem- we need to install Unity but can’t without a GUI. Oh well, let’s just go to Unity’s site, get the download link for the Hub-less version of the Unity version we need, and use wget to download it onto the server, right?
Um, something seems to be missing (can you guess what it is?):
Where’s the Linux download? It appears that the Unity site uses the OS string as reported by the browser’s user agent to determine which downloads to show you. VNC it is then. Yep, that worked. But: only for the Unity Hub download, from within the VNC session if I navigate to the Unity Download Archive to get the correct version that’s needed it still doesn’t show any Linux downloads.
What can we do?
Manipulate the public download link, of course!
Unity uses a version string for every version of Unity that’s publicly available, this can be found within the download link in the Unity Download Archive.
Find the Unity version you need and copy the download link (any of the ones shown are fine), for example the 2021.1.7 Unity Hub link is
unityhub://2021.1.7f1/d91830b65d9b. The version string is the alphanumeric string at the end of the URL, in this case,
Unity Linux distributions are packaged as tarballs, and you can access the Unity Editor download at
https://download.unity3d.com/download_unity/[version string here]/LinuxEditorInstaller/Unity.tar.xz. For example if we wanted to download 2021.1.7 (which as above the version string is
d91830b65d9b), the link would be
Note: despite the “LinuxEditorInstaller” the Linux downloads via that link are the full Unity Editor installs within compressed archives, without an installer. To launch, execute “Editor/Unity” (don’t forget to set rwx (aka 777) permissions on the Editor directory, as Unity needs to read, execute, and write to the directory).
Tip: to decompress this archive, use
$ tar -xf Unity.tar.xf, or as an added bonus for efficiency use
$ wget https://download.unity3d.com/download_unity/[version string here]/LinuxEditorInstaller/Unity.tar.xz && tar -xf Unity.tar.xf to download and then immediately decompress the tarball.
Building for non-Linux targets
As you might’ve guessed, the non-Hub version of Unity only contains the Unity playback engine for Linux, not other platforms. To add support for other platforms you’ll need to upload the playback engine directory for any platform you need to build for from another machine that already has the playback platforms you need installed- these playback platforms are OS-agnostic (it doesn’t matter if the machine you’re sourcing the files from is running another OS like Windows).
Unity playback engines are located in
Editor/Data/PlaybackEngines/ and the directories are self-explanatory- upload the entire directory that you require into the same directory on the Linux headless machine. Be aware that the same restrictions apply as normal for Apple’s OSes (Unity can only build the xcode solution, and not create the required binary).