Reputation: 2830
in a Unity3d project I have the following code, so the code that gets compiled will be different depending on what platform you are on.
#if UNITY_IPHONE
[DllImport ("__Internal")]
#else
[DllImport ("mylibrary")]
#endif
I'm wondering if something like this is possible and if so what is the correct syntax
#if UNITY_IPHONE or UNITY_EDITOR_OSX or UNITY_STANDALONE_OSX
[DllImport ("__Internal")]
#else
[DllImport ("mylibrary")]
#endif
Upvotes: 0
Views: 3188
Reputation: 6039
Use:
#if (UNITY_IPHONE || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX)
//other stuff
#else
//more other stuff
#endif
See the Microsoft documentation for C# preprocessor directives for more information.
Upvotes: 8