티스토리 뷰

Blog/Unity

Platform dependent compilation

초딩영웅 2018. 12. 15. 12:43

Document : https://docs.unity3d.com/Manual/PlatformDependentCompilation.html


Platform #define directives

The platform #define directives that Unity supports for your scripts are as follows:

Property:Function:
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_OSX#define directive for compiling/executing code specifically for Mac OS X (including Universal, PPC and Intel architectures).
UNITY_STANDALONE_WIN#define directive for compiling/executing code specifically for Windows standalone applications.
UNITY_STANDALONE_LINUX#define directive for compiling/executing code specifically for Linux standalone applications.
UNITY_STANDALONE#define directive for compiling/executing code for any standalone platform (Mac OS X, Windows or Linux).
UNITY_WII#define directive for compiling/executing code for the Wii console.
UNITY_IOS#define directive for compiling/executing code for the iOS platform.
UNITY_IPHONEDeprecated. Use UNITY_IOS instead.
UNITY_ANDROID#define directive for the Android platform.
UNITY_PS4#define directive for running PlayStation 4 code.
UNITY_XBOXONE#define directive for executing Xbox One code.
UNITY_TIZEN#define directive for the Tizen platform.
UNITY_TVOS#define directive for the Apple TV platform.
UNITY_WSA#define directive for Universal Windows Platform. Additionally, NETFX_CORE is defined when compiling C# files against .NET Core and using .NET scripting backend.
UNITY_WSA_10_0#define directive for Universal Windows Platform. Additionally WINDOWS_UWP is defined when compiling C# files against .NET Core.
UNITY_WINRTSame as UNITY_WSA.
UNITY_WINRT_10_0Equivalent to UNITY_WSA_10_0
UNITY_WEBGL#define directive for WebGL.
UNITY_FACEBOOK#define directive for the Facebook platform (WebGL or Windows standalone).
UNITY_ADS#define directive for calling Unity Ads methods from your game code. Version 5.2 and above.
UNITY_ANALYTICS#define directive for calling Unity Analytics methods from your game code. Version 5.2 and above.
UNITY_ASSERTIONS#define directive for assertions control process.

From Unity 2.6.0 onwards, you can compile code selectively. The options available depend on the version of the Editor that you are working on. Given a version number X.Y.Z (for example, 2.6.0), Unity exposes three global #define directives in the following formats: UNITY_XUNITY_X_Y and UNITY_X_Y_Z.

Here is an example of #define directives exposed in Unity 5.0.1:

UNITY_5#define directive for the release version of Unity 5, exposed in every 5.X.Y release.
UNITY_5_0#define directive for the major version of Unity 5.0, exposed in every 5.0.Z release.
UNITY_5_0_1#define directive for the minor version of Unity 5.0.1.

Starting from Unity 5.3.4, you can compile code selectively based on the earliest version of Unity required to compile or execute a given portion of code. Given the same version format as above (X.Y.Z), Unity exposes one global #define in the format UNITY_X_Y_OR_NEWER, that can be used for this purpose.


'Blog > Unity' 카테고리의 다른 글

Unity Advent Calendar 2018  (0) 2018.12.12
애니메이션 조작 - Animator 컴포넌트  (0) 2018.12.06
Unity + MultiPlayer Tutorials  (0) 2018.12.06
반딧불 만들기  (0) 2018.12.06
Shader Graph  (0) 2018.11.11
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
TAG
more
«   2026/04   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30
글 보관함