属性 方法
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宏定义官方文档

Unity各平台宏定义的更多相关文章

  1. Unity 代码改宏定义

    两个函数 PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup); //所有宏定义 ; 分割 PlayerSettings.SetS ...

  2. Unity 平台宏定义

    官方文档: https://docs.unity3d.com/Manual/PlatformDependentCompilation.html

  3. cocos2d-x C++ 判断当前平台宏定义大全

    /**************************************************************************** Copyright (c) 2010-201 ...

  4. Unity各平台内置宏定义

    属性 方法 UNITY_EDITOR #define directive for calling Unity Editor scripts from your game code. UNITY_EDI ...

  5. Unity3D 多平台 预编译 宏定义

    平台定义 UNITY_EDITOR 编辑器调用. UNITY_STANDALONE_OSX 专门为Mac OS(包括Universal,PPC和Intelarchitectures)平台的定义. UN ...

  6. Unity3D 多平台_预编译相关宏定义

    http://www.cnblogs.com/zhaoqingqing/p/3510332.html API地址:http://docs.unity3d.com/Documentation/Manua ...

  7. Linux Kernel代码艺术——系统调用宏定义

    我们习惯在SI(Source Insight)中阅读Linux内核,SI会建立符号表数据库,能非常方便地跳转到变量.宏.函数等的定义处.但在处理系统调用的函数时,却会遇到一些麻烦:我们知道系统调用函数 ...

  8. VC中预处理指令与宏定义详解

    刚接触到MFC编程的人往往会被MFC 向导生成的各种宏定义和预处理指令所吓倒,但是预处理和宏定义又是C语言的一个强大工具.使用它们可以进行简单的源代码控制,版本控制,预警或者完成一些特殊的功能. 一个 ...

  9. C中的预编译宏定义

     可以用宏判断是否为ARC环境 #if _has_feature(objc_arc) #else //MRC #endif C中的预编译宏定义 -- 作者: infobillows 来源:网络 在将一 ...

随机推荐

  1. centos7清理矿机木马qw3xT,kpgrbcc

    腾讯云报告了root口令被暴力破解,并种了木马kpgrbcc 昨晚找到/usr/bin/ rm -rf kpgrbcc 删除 rm -rf kpgrbcb 删除 并ps -ef | grep kpg ...

  2. 编译k8s1.11 kube-apiserver源码

    说明 修改k8s1.11 kube-apiserver源码并构建成镜像,最终替换运行在集群中的kube-apiserver pod来验证本次源码修改 参看链接:https://xinchen.blog ...

  3. 【Stream—7】NetworkStream相关知识分享

    一.NetworkStream的作用 和先前的流有所不同,NetworkStream的特殊性可以在它的命名空间中得以了解(System.Net.Sockets),聪明的你马上就会反应过来:既然是在网络 ...

  4. mysql安装与sqlyog安装

    首先是mysql安装,参考下面两个链接 https://www.cnblogs.com/gengyufei/p/11735358.html#_label4 https://www.jb51.net/a ...

  5. scss--函数 (Functions)--unitless

    (Sass::Script::Value::Bool) unitless($number) Returns whether a number has units. Examples: unitless ...

  6. Photoshop CS5软件安装教程

    Photoshop CS5(32/64位)精简版下载地址: 链接:https://pan.baidu.com/s/11T-L-aH3JNXlJmSqL0JY6Q提取码:ea5j Photoshop主要 ...

  7. 【前端】 在前端利用数学函数知识+box-shadow解波浪图形

    序 今天正在刷数学函数相关题目,刷到了下面这篇文章,哇哦-有意思. 利用cos和sin实现复杂的曲线.传送门在下面. CSS 技巧一则 -- 在 CSS 中使用三角函数绘制曲线图形及展示动画 正巧在复 ...

  8. 2019年12月2日Linux开发手记

    开始学习在Linux下视频源捕获驱动框架,也就是V4L2(video4linux),本次关于v4l2的知识准备主要在于其的官方例程,理解官方例程也就差不多掌握了v4l2的基本内容.例程在:http:/ ...

  9. fastjson 1.2.24-基于JdbcRowSetImpl的PoC构造与分析

    前言: 基于fastjson的第一种payload是基于templatesImpl的方式,但是这种方式要求Feature.SupportNonPublicField才能打开非公有属性的反序列化处理,是 ...

  10. IDEA必备插件系列 - Key Promoter X(快捷键使用提示)

    Key Promoter X 是用于基于 IntelliJ 产品(如 IDEA,Android Studio 或 CLion)的插件,它有助于在工作时从鼠标操作中 学习基本的键盘快捷键. 当您在 ID ...