两种方式
————— C预处理器编译判断 —————
#if UNITY_IOS // ... iOS项目才会编译 #elif UNITY_ANDROID // ... apk 或 iOS项目才会编译 #elif UNITY_EDITOR // ... UNITY调试时候才编译 #endif
————— 代码运行时判断 —————
if(Application.platform == RuntimePlatform.Android) { //只有在安卓生效 }
:)
两种方式
————— C预处理器编译判断 —————
#if UNITY_IOS // ... iOS项目才会编译 #elif UNITY_ANDROID // ... apk 或 iOS项目才会编译 #elif UNITY_EDITOR // ... UNITY调试时候才编译 #endif
————— 代码运行时判断 —————
if(Application.platform == RuntimePlatform.Android) { //只有在安卓生效 }
:)