方法一: 判断当前的平台 switch (Application.platform) { case RuntimePlatform.WindowsEditor://PC端 print("aaaa"); break; case RuntimePlatform.Android://android手机 print("cccc"); break; } 方法二:通过宏定义判断 #if UNITY_IPHONE || UNITY_ANDROID public static bool isAndroid = true; #else public static bool isAndroid = false; #endif
原文:http://blog.csdn.net/myk7694503/article/details/43563097