for (int i = 0; i < 6; i++) { #if UNITY_IPHONE
Debug.Log(“iPhone Only”); #endif
Debug.Log(i);
}
I would have expected the iPhone Only not to print in the editor, but it does, which is extremely annoying, but more troubling is that it only prints 1 out of the 6 times in this IF statement. Why?
The editor will define UNITY_IPHONE when the build platform is set to iOS.
If you don’t want this to happen you should just add this line:
if(!Application.isEditor),The Editor will run code with UNITY_IPHONE defined when you’re build platform is set to iOS. If you don’t want this to happen you can simply add a non-preprocessor statement like this: