Unity平台判断
来源:互联网 发布:淘宝详情页懒人模板 编辑:程序博客网 时间:2024/06/05 22:57
本文原创发表在 http://wycode.cn/blog/
Unity 平台的判断包含编译时判断和运行时判断,总结如下:
编译时
#if UNITY_EDITOR Debug.Log("Unity Editor"); #endif #if UNITY_IOS Debug.Log("Iphone"); #endif #if UNITY_STANDALONE_OSX Debug.Log("Stand Alone OSX"); #endif #if UNITY_STANDALONE_WIN Debug.Log("Stand Alone Windows"); #endif
可以使用||
和&&
进行组合
平台定义
- UNITY_EDITOR
- UNITY_EDITOR_WIN
- UNITY_EDITOR_OSX
- UNITY_STANDALONE_OSX
- UNITY_STANDALONE_WIN
- UNITY_STANDALONE_LINUX
- UNITY_STANDALONE
- UNITY_WII
- UNITY_IOS
- UNITY_IPHONE
- UNITY_ANDROID
- UNITY_PS4
- UNITY_SAMSUNGTV
- UNITY_XBOXONE
- UNITY_TIZEN
- UNITY_TVOS
- UNITY_WP_8_1
- UNITY_WSA
- UNITY_WSA_8_1
- UNITY_WSA_10_0
- UNITY_WINRT
- UNITY_WINRT_8_1
- UNITY_WINRT_10_0
- UNITY_WEBGL
- UNITY_ADS
- UNITY_ANALYTICS
- UNITY_ASSERTIONS
官方文档:https://docs.unity3d.com/Manual/PlatformDependentCompilation.html
运行时
if(Application.platform == RuntimePlatform.WindowsWebPlayer){ Debug.Log("Windows Web Player");}
平台枚举
- OSXEditor
- OSXPlayer
- WindowsPlayer
- OSXDashboardPlayer
- WindowsEditor
- IPhonePlayer
- Android
- LinuxPlayer
- LinuxEditor
- WebGLPlayer
- WSAPlayerX86
- WSAPlayerX64
- WSAPlayerARM
- TizenPlayer
- PSP2
- PS4
- XboxOne
- SamsungTVPlayer
- WiiU
- tvOS
- Switch
官方文档:https://docs.unity3d.com/ScriptReference/RuntimePlatform.html
本文原创发表在 http://wycode.cn/blog/
阅读全文
0 0
- Unity平台判断
- Unity运行平台判断
- Unity - 判断当前所属平台
- unity各平台判断条件
- 判断平台
- Unity之一天一个技术点(三)---判断当前运行的平台
- Unity平台宏定义
- unity平台的预处理
- Unity 平台区分
- unity 平台检测
- Unity区分平台编译
- unity平台的预处理
- unity平台的预处理
- unity 平台控制宏
- unity平台的预处理
- unity平台的预处理
- {Unity} 平台预定义
- unity平台的预处理
- python中图片处理之调整图片大小
- 深入源码解析Android中的Handler,Message,MessageQueue,Looper
- MYSQL 时间查询的范围
- Vim技能修炼教程(9)
- 全双工 半双工 单工 通信,同步和异步
- Unity平台判断
- 268. Missing Number
- RocketMQ实战(四)
- "No subject alternative names present" solved
- c++ 之 复数类的实现
- Friends and Subsequences
- vector(2)
- Gcc 安装
- 在linux中执行wget命令提示 -bash: wget: command not found 解决方法