unity 平台判断
程序员文章站
2022-04-03 22:18:12
...
使用预编译:
#if UNITY_ANDROID
Debug.Log("安卓设备");
#endif
#if UNITY_IPHONE
Debug.Log("苹果设备");
#endif
#if UNITY_STANDALONE_WIN
Debug.Log("windows电脑");
#endif
运行时判断:
switch (Application.platform)
{
case RuntimePlatform.WindowsEditor:
print("Windows");
break;
case RuntimePlatform.Android:
print("Android");
break;
case RuntimePlatform.IPhonePlayer:
print("Iphone");
break;
}
下一篇: 淘宝客推广:如何让店铺在淡季中崛起?