- Home /
Programmatically get version of Unity installed on a machine
Hello,
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?
Thanks,
Clem
Did you ever find out how to do this? I'm working with 2 versions of unity and building a .dll so have to build 2 .dll files for some cases at the moment.
Answer by unimechanic · Jul 09, 2013 at 04:33 PM
Currently you can obtain some version information this way:
using UnityEditorInternal;
...
DateTime dt = new DateTime(1970, 1, 1, 0, 0, 0, 0);
Debug.Log(
"Unity version = " + Application.unityVersion + "\n" +
"Full Unity version = " + InternalEditorUtility.GetFullUnityVersion() + "\n" +
"Version date = " + dt.AddSeconds(InternalEditorUtility.GetUnityVersionDate()));
Answer by Korbinian · Sep 17, 2019 at 08:21 PM
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
Answer by Muzz5 · Dec 16, 2011 at 02:02 PM
Check for updates. It will tell you your current version number.
Answer by Statement · Dec 15, 2011 at 03:45 PM
Have you checked out the version defines? I'm not sure if you're looking for a runtime check or a compile time check, or just a setting?
More examples here.
Thanks for the suggestion but I don't think it's what I am looking for. I want to be able to deter$$anonymous$$e which version of Unity is installed on a machine without having to open Unity. I was thinking maybe there is a version file or something in Unity's install folder. Ideally the solution would on $$anonymous$$ac and PC.
Do you mean webplayer version? I think Unity standalones are self-contained, but I'm not totally sure on that. It seems that %appdata%\..\LocalLow\Unity\WebPlayer\player\2.x.x
and 3.x.x
on Windows contains a plist file which contain the version number for the player. If you fail to get an appropriate answer here, you could try contacting unity support. They should know for sure.
Sorry I should have been clearer. I want to know the version of the Editor installed on a build machine. I'll have a look a what you suggested.
Answer by FWCorey · Jan 11, 2013 at 11:32 PM
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.
There is also the (currently undocumented but shows up in intellisense) Application.unityVersion property.
Your answer
![](https://koobas.hobune.stream/wayback/20220613062116im_/https://answers.unity.com/themes/thub/images/avi.jpg)