原文地址:http://docs.unity3d.com/Manual/PlatformDependentCompilation.html
Unity3D通过预编译指令实现分平台编译(翻译)
Unity的这一功能被命名为“依赖于平台的编译”。这包含了一些预编译处理指令,让你可以专门的针对不同的平台分开编译和执行一段代码。
此外,你可以在编辑器下执行一些代码用于测试而不影响你编译到手机或者其他平台的代码。
平台定义:
对您的脚本支持的平台定义有:
|
|
UNITY_EDITOR |
用于执行UnityEditor模式下的脚本的定义. |
UNITY_STANDALONE_OSX |
用于编译和执行专门针对Mac OS的代码的平台定义. |
UNITY_DASHBOARD_WIDGET |
为创建Dashboard widget工具的代码的平台定义. |
UNITY_STANDALONE_WIN |
专门为Windows的独立应用程序编译/执行代码的平台定义. |
UNITY_STANDALONE_LINUX |
专门为Linux的独立应用程序编译/执行代码的平台定义. |
UNITY_STANDALONE |
|
UNITY_WEBPLAYER |
|
UNITY_WII |
专门为Wii游戏机编译和执行代码的平台定义. |
UNITY_IPHONE |
为iPhone平台的编译和执行代码的平台定义. |
UNITY_ANDROID |
为安卓平台的编译和执行代码的平台定义. |
UNITY_PS3 |
为PS3编译和执行代码的平台定义. |
UNITY_XBox360 |
|
UNITY_NACL |
为谷歌客户端编译和执行代码的平台定义.(这是对UNITY_WEBPLAYER的补充). |
UNITY_FLASH |
为AdobeFlash编译和执行代码的平台定义. |
UNITY_2_6 |
Unity 2.6的平台定义. |
UNITY_2_6_1 |
Unity 2.6.1的平台定义. |
UNITY_3_0 |
Unity 3.0的平台定义. |
UNITY_3_0_0 |
Unity 3.0.0的平台定义. |
UNITY_3_1 |
Unity 3.1的平台定义.. |
UNITY_3_2 |
Unity 3.2的平台定义. |
UNITY_3_3 |
Unity 3.3的平台定义. |
UNITY_3_4 |
Unity 3.4的平台定义. |
UNITY_3_5 |
Unity 3.5的平台定义. |
UNITY_4_0 |
Unity 4.0的平台定义. |
UNITY_4_0_1 |
Unity 4.0.1的平台定义. |
UNITY_4_1 |
Unity 4.1的平台定义. |
Property: | Function: |
---|---|
UNITY_EDITOR | Define for calling Unity Editor scripts from your game code. |
UNITY_EDITOR_WIN | Platform define for editor code on Windows. |
UNITY_EDITOR_OSX | Platform define for editor code on Mac OSX. |
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_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 (additionallyNETFX_COREis defined when compiling C# files against .NET Core). |
UNITY_WINRT | Equivalent toUNITY_WP8|UNITY_METRO |
UNITY_2_6 | Platform define for the major version of Unity 2.6. |
UNITY_2_6_1 | Platform define for specific version 2.6.1. |
UNITY_3_0 | Platform define for the major version of Unity 3.0. |
UNITY_3_0_0 | Platform define for specific version 3.0.0. |
UNITY_3_1 | Platform define for major version of Unity 3.1. |
UNITY_3_2 | Platform define for major version of Unity 3.2. |
UNITY_3_3 | Platform define for major version of Unity 3.3. |
UNITY_3_4 | Platform define for major version of Unity 3.4. |
UNITY_3_5 | Platform define for major version of Unity 3.5. |
UNITY_4_0 | Platform define for major version of Unity 4.0. |
UNITY_4_0_1 | Platform define for specific version 4.0.1. |
UNITY_4_1 | Platform define for major version of Unity 4.1. |
UNITY_4_2 | Platform define for major version of Unity 4.2. |
UNITY_4_3 | Platform define for major version of Unity 4.3. |
UNITY_4_5 | Platform define for major version of Unity 4.5. |
<Project Path>/Assets/smcs.rsp | |
C# - Editor Scripts | <Project Path>/Assets/gmcs.rsp |
UnityScript | <Project Path>/Assets/us.rsp |
Boo | <Project Path>/Assets/boo.rsp |