Unity判断所在平台,分别编译
发布日期:2022-02-17 02:40:01 浏览次数:23 分类:技术文章

本文共 1656 字,大约阅读时间需要 5 分钟。

#if的作用是指导编译器针对不同的情况分别编译。例如:

1
2
3
4
5
6
7
#ifUNITY_ANDROID
    
Debug.Log(
"Android"
);
#endif
 
#if UNITY_IPHONE
    
Debug.Log(
"IOS"
);
#endif

众所周知,Unity跨平台非常的多,下面是所有平台的关键字

UNITY_EDITOR

Define for calling Unity Editor scripts from your game code.

UNITY_STANDALONE_OSX

Platform define for compiling/executing code specifically for Mac OS (This includes Universal, PPC and Intel architectures).

UNITY_DASHBOARD_WIDGET

Platform define when creating code for Mac OS dashboard widgets.

UNITY_STANDALONE_WIN

Use this when you want to compile/execute code for Windows stand alone applications.

UNITY_STANDALONE_LINUX

Use this when you want to compile/execute code for Linux stand alone applications.

UNITY_STANDALONE

Use this to compile/execute code for any standalone platform (Mac, Windows or Linux).

UNITY_WEBPLAYER

Platform define for web player content (this includes Windows and Mac Web player executables).

UNITY_WII

Platform define for compiling/executing code for the Wii console.

UNITY_IPHONE

Platform define for compiling/executing code for the iPhone platform.

UNITY_ANDROID

Platform define for the Android platform.

UNITY_PS3

Platform define for running PlayStation 3 code.

UNITY_XBOX360

Platform define for executing Xbox 360 code.

UNITY_NACL

Platform define when compiling code for Google native client (this will be set additionally to UNITY_WEBPLAYER).

UNITY_FLASH

Platform define when compiling code for Adobe Flash.

UNITY_BLACKBERRY

Platform define for a Blackberry10 device.

UNITY_WP8

Platform define for Windows Phone 8.

UNITY_METRO

Platform define for Windows Store Apps (additionally NETFX_CORE is defined when compiling C# files against .NET Core).

转载地址:https://blog.csdn.net/qq_39816832/article/details/80266610 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Bugly Unity Plugin
下一篇:2021-04-23

发表评论

最新留言

初次前来,多多关照!
[***.217.46.12]2024年04月02日 02时39分08秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章

向量空间 Vector Space -- 推荐系统 2019-04-28
B+树 -- MySQL数据库索引 2019-04-28
A*搜索算法--游戏寻路 2019-04-28
安装 | MatlabR2019b: License Manager Error -8. License checkout failed. 2019-04-28
计算机视觉与深度学习 | 基于MATLAB的Vibe算法消除鬼影(代码版) 2019-04-28
北斗导航 | GNSS卫星导航天线在车载高精度定位领域中的应用与挑战 2019-04-28
北斗导航 | GNSS技术在自动驾驶中的作用 2019-04-28
北斗导航 | RAIM接收机自主完好性检测(附代码) 2019-04-28
北斗导航 | 学习PPP和PPP-RTK 2019-04-28
北斗导航 | 基于RTK的GNSS与多源融合定位技术发展与挑战 2019-04-28
安装 | 最新MATLAB 2020b(64位)安装教程完整版 2019-04-28
北斗导航 | 微惯导定位系统关键技术与应用 2019-04-28
北斗导航 | PPP-RTK技术研究进展与试验验证(第十一届中国卫星导航年会报告) 2019-04-28
北斗导航 | 北斗/GNSS精密定位:从PPP-RTK 到 Vision-PPP(第十一届中国卫星导航年会报告) 2019-04-28
北斗导航 | 多GNSS系统PPP-RTK原型系统及性能分析(2020 CPGPS全球华人导航定位协会年会) 2019-04-28
计算机视觉与深度学习 | 不含动态背景的前景目标提取 2019-04-28
计算机视觉与深度学习 | 动态背景下的前景目标提取 2019-04-28
《数据“科学家”必读》 | 从零起步打造数字化业务「最强大脑」 2019-04-28
好消息!Azure Active Directory 域服务在中国区正式发布! 2019-04-28
《数据“科学家”必读》 | 与Cosmos DB实现数据同步 2019-04-28