More of a curious question then anything and maybe I’m not asking the correct question but is there a way to make your own constant if statement like
#if UNITY_ANDROID
private void GetAndroidDeviceID()
{
//Get Data Blah.
}
#endif
or
#if UNITY_EDITOR
private Editor OpenEditorWindow()
{
//Do Something.
return null;
}
#endif
I’ve seen this in installed SDK packages before but cannot find in their code how they are made to reverse engineer.
GOOGLEGAMES or FACEBOOK for example have them but not sure how to set this up for myself if i so choose.
Namey5
2
You can create your own custom per-platform defines in the ‘Other’ section of the Player Settings;
If you want multiple, just separate them with a semicolon ( ; ). You can also define them directly in the script using the #define preprocessor directive, i.e;
#define CUSTOM_CONDITION
...
#if CUSTOM_CONDITION
DoSomething();
#endif