- Home /
Editor check if unity pro license installed
I'm writing an editor script that can build asset bundles, or it can build prefabs instead. I know that if I transfer this to a machine that does not have unity pro, it will not compile because I use some functions only available with the pro version. Basically what I wanted was:
#if UNITYPRO
// my code...
#endif
but that is not an option if you look here:
http://unity3d.com/support/documentation/Manual/Platform%20Dependent%20Compilation.html
Would somebody please tell me how I can use conditional compilation to check if unity pro is installed?
the one api call I know off is http://unity3d.com/support/documentation/ScriptReference/PlayerSettings-advancedLicense.html that's really a shame we can script based on the pro or non pro. But I think if you write plugins as dll, unity ought to give you access to that kind of things no?
Answer by kork · Dec 31, 2012 at 09:57 AM
Basically it should compile because the free version is basically the same version as the Pro version API-wise. There are checks in the code of the Unity internal classes which will simply log a message when calling a function that is Pro-only on Unity Free. Nevertheless you should be able to compile classes that use Unity Pro on Unity Free. You will just not be able to run them. If you want to check in your editor script if the currently run version is Unity Pro use:
bool hasPro = UnityEditorInternal.InternalEditorUtility.HasPro()
And provide a meaningful message in your code should it require Unity Pro but runs on Unity Free.
Well, the OP asked for a way to check this in the editor, and for that use case it's pretty much doing what the OP asked for ;).
Answer by Noah-1 · Jan 05, 2012 at 03:59 PM
The only thing I can think of is to make a script that reads the type of license the user has but that would be hard.
I would create a pop up message that asks if you have Unity pro or not and I would add a warning message saying : Warning if you do not own a copy of Unity pro this wont compile as expected.