I am wondering if there is any way to know the version of Unity installed on a machine (PC or Mac). We have multiple build machines constantly building our game and sometimes we want to be able to build it on a specific version of Unity - for example 3.5 beta. At the moment we do this by installing Unity on a new build machine and then add it to our Continuous Integration server. For each build new build agent we have to enter the Unity version it supports automatically. This is a bit tidious and we would like our CI server to be able to work out what version of Unity is installed on a machine automatically.
Is there a file somewhere in Unity’s installation folder that would give me the information I need?
These days it’s surely easiest to use the UnityHub, which finally got a command line interface.
It’s easy to enumerate editors installed through the hub, and to install any version if you know the changeset hash, like unityhub://2019.2.5f1/9dace1eed4cc
Check the help screen with (on Windows) "Unity Hub.exe" -- --headless help
generate an editor script that includes a #if define, get the result, set an editor pref, then purge the dummy script. I know it’s clunky but it’ll work.
Pretty old post, but for those who see this, UnitySetup is a OSS PowerShell module that supports automating Unity and is super useful for build machines. You can use it to discover all the versions available on a machine and even install new components or versions. You can also use it to automate the Unity editor and register/return licenses.
We use it’s PowerShell DSC resources to automated our entire build infrastructure’s use of Unity.