Unity各平台内置宏定义
| 属性 | 方法 |
|---|---|
| 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各平台内置宏定义的更多相关文章
- 获取gcc和clang的内置宏定义
下面是对Gcc的内置宏定义的解释: https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html https://github.co ...
- C++ 内置宏定义 与 预编译指令
内置宏和预编译指令, 在代码调试.单元测试.跨平台代码中经常会用到.这里记录一下. 1. 内置宏 (文件名,当前行号,当前日期,当前时间,当前执行方法名) __FILE____LINE____DATE ...
- 查看GCC的内置宏定义
开发过程中我们常常需要使用宏定义.. 为了尽可能多的使用GCC为我们提供的特性,首先我们需要知道gcc提供了那些特性... gcc -dM -E - < /dev/null 没错,就这么一句话就 ...
- unity 着色器内置宏
目标平台 Macro: Target platform: SHADER_API_D3D11 Direct3D 11 SHADER_API_GLCORE Desktop OpenGL “core” (G ...
- 编译器内置宏__LINE__&__FUNCTION__
编译器内置宏: 先介绍几个编译器内置的宏定义,这些宏定义不仅可以帮助我们完成跨平台的源码编写,灵活使用也可以巧妙地帮我们输出非常有用的调试信息. ANSI C标准中有几个标准预定义宏(也是常用的): ...
- c语言编译器内置宏
注:转自http://www.cnblogs.com/lixiaohui-ambition/archive/2012/08/21/2649052.html 感谢分享 前言: 我们在写程序的时候,总是 ...
- 一起talk C栗子吧(第一百二十四回:C语言实例--内置宏)
各位看官们,大家好,上一回中咱们说的是显示变量和函数地址的样例,这一回咱们说的样例是:内置宏.闲话休提,言归正转.让我们一起talk C栗子吧! 看官们,我们在编译程序的时候,假设有语法错误,编译器就 ...
- python函数基础:调用内置函数&定义函数
调用内置函数 有很多内置函数,在使用中需要积累.这里只举两个例子: 分别调用abs和数据类型转换,注意当入参类型错误时候会报错 ''' print('abs(-100)') abs(-100) pri ...
- c/c++一些常用的内置宏
关于 本文演示环境: win10 + VS2017 Note 市面上的编译器五花八门,但是通常都支持: __DATE__,__FILE__,__LINE__ 和 __TIME__ 这个4个宏 VS20 ...
随机推荐
- 解决react不能往setState中传key作为参数的办法(文章最后实现了传递key做参数的办法)
读者朋友可以直接看最后一个分割线下面的那部分!利用方括号语法来动态的访问对象的属性,实现当参数为属性名的传递; 有时候我们需要每次单独设置众多state中的一个,但是,都是进行相同的操作,这时候如果每 ...
- ORACLE数据仓库学习记录
一.数据仓库安装 安装ORACLE DATABASE 10g Release 2 ORACLE数据库版本是:10.2.0.1.0(服务器).执行基本安装(安装全部的组件)并创建示例数据库. 安装ORA ...
- Nuget Tips
Install-Package时老是提示找不到Available Source,研究了下Nuget Package Manager的配置.发现有两个地方可以改: 1.Visual Studio中Too ...
- android studio新建项目时出现Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
android studio更新后创建新项目时出现以下错误 可以用Build->Rebuild Project解决,但这个方法只是临时的,重新打开项目还是会报错 所以用另一种方法: 在app下的 ...
- 关于App的cpu/内存/流量 /电量的方法(GT工具)
https://mp.weixin.qq.com/s?__biz=MzUzNTQxMzMzMg==&mid=2247484376&idx=1&sn=651e9cf22801b5 ...
- mvn install 时候报GBK编码错误解决办法
在pom.xml里面 <properties> <!-- 文件拷贝时的编码 --> <project.build.sourceEncoding>UTF-</p ...
- tomcat7环境
官方下载页面:http://tomcat.apache.org/download-70.cgi 选择64-bit Windows zip下载 解压后,进入tomcat-7.0.73\bin目录,双击运 ...
- springboot整合fastdfs实现上传和下载
FastDFS_Client源码 https://github.com/tobato/FastDFS_Client 友情提示:由于FastDFS_Client这个源码不是很多,并且目前没有找到相关文档 ...
- C++学习笔记——C++简介
1.C++发展史 C++语言来源于C语言,在C语言的基础上增加了面向对象设计的要素从而得到了发展. 1979 年,C++ 是由 Bjarne Stroustrup在新泽西州美利山贝尔实验室开始设计开发 ...
- ORM的补充
之前学习的orm的操作类似: create delete update filter/all exclude values values_list get first last order_by 补充 ...