Http://www.cnblogs.com/zhaoqingqing/p/3510332.html
API Address: http://docs.unity3d.com/Documentation/Manual/PlatformDependentCompilation.html
Platform definition
Called by the Unity_editor editor.
UNITY_STANDALONE_OSX is specifically defined for Mac OS (including UNIVERSAL,PPC and intelarchitectures) platforms.
Unity_dashboard_widget Mac OS DASHBOARD widget (Mac OS Dashboard widget).
Unity_standalone_win Windows operating system.
Unity_standalone_linux is a standalone application for LINUX.
Unity_standalone stand-alone platform (Mac,windows or Linux).
Unity_webplayer Web player (including Windows and Mac Web Player executables).
Unity_wii WII Console platform.
Unity_iphone IPHONE platform.
Unity_android ANDROID platform.
UNITY_PS3 PlayStation 3.
Unity_xbox360 Xbox 360.
Unity_nacl Google Native Client (use this must additionally use Unity_webplayer).
Unity_flash Adobe FLASH.
You can also judge the Unity version, the currently supported version
The Unity_2_6 platform is defined as the major version of Unity 2.6.
The Unity_2_6_1 platform defines major version 1 of the specific version 2.6.
The UNITY_3_0 platform is defined as the major version of Unity 3.0.
The Unity_3_0_0 platform defines a specific version of Unity 3.0 0.
The Unity_3_1 platform is defined as the major version of Unity 3.1.
The Unity_3_2 platform is defined as the major version of Unity 3.2.
The Unity_3_3 platform is defined as the major version of Unity 3.3.
The Unity_3_4 platform is defined as the major version of Unity 3.4.
The Unity_3_5 platform is defined as the major version of Unity 3.5.
The UNITY_4_0 platform is defined as the major version of Unity 4.0.
Unity_4_0_1 Major Version 4.0.1 unified platform definition.
The Unity_4_1 platform is defined as the major version of Unity 4.1.
The Unity_4_2 platform is defined as the major version of Unity 4.2.
Operating Platform
Get the current running platform Debug.Log ("plat =" + application.platform);
The type of platform that can be obtained enum runtimeplatform { osxeditor = 0, osxplayer = 1, windowsplayer = 2, osxwebplayer = 3, osxdashboardplayer = 4, windowswebplayer = 5, wiiplayer = 6, Windowseditor = 7, Iphoneplayer = 8, PS3 = 9, XBOX360 = ten, Android = one, NaCl = One, linuxpl Ayer = Flashplayer =, }
Example
Jsfunction 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}C#Using Unityengine;Using System.Collections;PublicClass Platformdefines:monobehaviour {void Start () { #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 ( #endif}} //booimport unityengineclass Platformdefines (monobehaviour): Def Start (): Ifdef UNITY_EDITOR:Debug.Log ( "UNITY EDITOR") ifdef UNITY_IPHONE:Debug.Log ( " IPhone ") ifdef UNITY_STANDALONE_OSX:Debug.Log (" stand Alone OSX ") ifdef not UNITY_IPHONE:Debug.Log ( span class= "str" > "not an IPhone")
Unity3d Multi-platform _ precompiled related macro definitions