- Home /
Platform dependent flags required in Using/Namespace definition?
vUnity 2017.3
Developing for both iOS/Android and I am using the following in one of my scripts:
using UnityEngine;
using UnityEngine.iOS; <----
using Whatever;
Does this need to be contained within the platform dependent flags when I build to Android?
using UnityEngine;
#if UNITY_IOS
using UnityEngine.iOS;
#endif
using Whatever;
Thanks in advance!
Thanks, I did that already. However I had a batch of errors out of the Android build process and being a novice to Android, was looking for some help to start knocking down the problems.
This was just a general information question at large however to help continue my scripting education.
Appreciate your help.
Answer by kyle-misner-kriel · May 23, 2018 at 05:50 PM
Yes, as well as the code using it. Alternatively, you you fully quality the reference isolating your iOS dependent code to a fewer number of spots in your code. So instead of:
#if UNITY_IOS
using UnityEngine.iOS;
#endif
...
#if UNITY_IOS
ReportGeneration(Device.generation);
#endif
You could have:
#if UNITY_IOS
ReportGeneration(UnityEngine.iOS.Device.generation);
#endif
Gotcha. Yep, I was doing that in the body of my work, but just containing it all in the single ref is much simpler. I don't have that many references, so thanks for the nudge!