I made a script that has certain functions with iPhone-specific code, and for the computer version I replace that with another script with the same functions, but different code that works on the computer. The rest of the scripts are unchanged, although there are a few parts that use
if (iPhoneVersion) {
// do iPhone stuff
}
else {
// do computer stuff
}
Do you manually replace that script, or is there a way to specify that a certain script is only enabled for certain build platforms (as it is possible in visual studio)?
Don’t you get any warnings on the check ‘if (iPhoneVersion)’?
I get warnings about unreachable code and would like to find a way to get rid of them, so more important warnings don’t go unnoticed.
UNITY_IPHONE define if you build from unity iphone
to use it you would use
#if UNITY_IPHONE
#else
#endif
I’m unsure if there are such flags for desktop or which ones (potentially a UNITY_WEB / OSX / WIN flag), as those platforms are far less distinct than iphone from the rest (pc to non pc)