Unity各平台宏定义
2024-10-21 07:37:51
属性 | 方法 |
---|---|
UNITY_EDITOR | #define directive for calling Unity Editor scripts from your game code. |
UNITY_EDITOR_WIN | #define directive for Editor code on Windows. |
UNITY_EDITOR_OSX | #define directive for Editor code on Mac OS X. |
UNITY_STANDALONE | #define directive for compiling/executing code for any standalone platform (Mac OS X, Windows or Linux). |
UNITY_STANDALONE_WIN | #define directive for compiling/executing code specifically for Windows standalone applications. |
UNITY_STANDALONE_OSX | #define directive for compiling/executing code specifically for Mac OS X (including Universal, PPC and Intel architectures). |
UNITY_STANDALONE_LINUX | #define directive for compiling/executing code specifically for Linux standalone applications. |
UNITY_ANDROID | #define directive for the Android platform. |
UNITY_IOS | #define directive for compiling/executing code for the iOS platform. |
UNITY_IPHONE | Deprecated. Use UNITY_IOS instead. |
UNITY_WEBGL | #define directive for WebGL. |
UNITY_WP_8_1 | #define directive for Windows Phone 8.1. |
UNITY_PS4 | #define directive for running PlayStation 4 code. |
UNITY_XBOXONE | #define directive for executing Xbox One code. |
UNITY_WII | #define directive for compiling/executing code for the Wii console. |
UNITY_SAMSUNGTV | #define directive for executing Samsung TV code. |
样例:
// C#
using UnityEngine;
using System.Collections; public class PlatformDefines : MonoBehaviour { void Start () {
#if UNITY_EDITOR
Debug.Log("Unity Editor");
#elif UNITY_IOS
Debug.Log("Unity iPhone");
#else
Debug.Log("Any other platform");
#endif
} }
// JS
function Awake() {
#if UNITY_EDITOR
Debug.Log("Unity Editor");
#endif #if UNITY_IPHONE
Debug.Log("Iphone");
#endif #if UNITY_STANDALONE_OSX
Debug.Log("Stand Alone OSX");
#endif #if UNITY_STANDALONE_WIN
Debug.Log("Stand Alone Windows");
#endif
}
最新文章
- Python使用QRCode模块生成二维码
- Linux下C语言编程实现spwd函数
- ASCII码
- Js 类定义的几种方式
- (转)unity中基于alpha通道的shadow volume实现
- Linux中断技术、门描述符、IDT(中断描述符表)、异常控制技术总结归类
- 我的第一个chrome扩展(1)——读样例,实现时钟
- Android:控件ListView列表项与适配器结合使用
- Spring mvc基本原理
- ionic 使用了 crosswalkwebview 所产生的bug 及 解决方案
- usaco 2008 月赛 lites 开关灯 题解
- year:2017 month:8 day:1+
- 【java提高】---ArrayList源码
- 应用负载均衡之LVS(三):使用ipvsadm以及详细分析VS/DR模式
- windows设置照片查看器为默认的照片查看软件
- JHipster生成微服务架构的应用栈(五)- 容器编排示例
- C++继承中关于子类构造函数的写法
- 基于hiredis,redis C客户端封装
- HDUOJ---汉洛塔IX
- boost::string 例题1