属性 方法
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
}

Unity宏定义官方文档

最新文章

  1. Python使用QRCode模块生成二维码
  2. Linux下C语言编程实现spwd函数
  3. ASCII码
  4. Js 类定义的几种方式
  5. (转)unity中基于alpha通道的shadow volume实现
  6. Linux中断技术、门描述符、IDT(中断描述符表)、异常控制技术总结归类
  7. 我的第一个chrome扩展(1)——读样例,实现时钟
  8. Android:控件ListView列表项与适配器结合使用
  9. Spring mvc基本原理
  10. ionic 使用了 crosswalkwebview 所产生的bug 及 解决方案
  11. usaco 2008 月赛 lites 开关灯 题解
  12. year:2017 month:8 day:1+
  13. 【java提高】---ArrayList源码
  14. 应用负载均衡之LVS(三):使用ipvsadm以及详细分析VS/DR模式
  15. windows设置照片查看器为默认的照片查看软件
  16. JHipster生成微服务架构的应用栈(五)- 容器编排示例
  17. C++继承中关于子类构造函数的写法
  18. 基于hiredis,redis C客户端封装
  19. HDUOJ---汉洛塔IX
  20. boost::string 例题1

热门文章

  1. Vue注册组件命名时不能用大写的原因浅析
  2. 2019-9-12:渗透测试,基础学习,Linux下用户管理笔记
  3. 基于loghub的消息消费延迟监控
  4. 虚拟机中linux操作系统raid10(5块磁盘)配置流程及损坏磁盘的移除
  5. PHP经典面试题目汇总
  6. Java基础IO类之字符串流(查字符串中的单词数量)与管道流
  7. html元素是否包含另外一个元素,以及classList属性
  8. 华为云 AI 实战营计划,带你迈上 AI 之路
  9. Python-TCP客户端程序开发
  10. 转:Spring事务管理