http://docs.unity3d.com/kr/current/Manual/PlatformDependentCompilation.html

http://dkdlel072.tistory.com/entry/unity-%EC%BB%B4%ED%8C%8C%EC%9D%BC%EC%8B%9C-%ED%94%8C%EB%9E%AB%ED%8F%BC-%EA%B5%AC%EB%B6%84-%EB%B0%A9%EB%B2%95

http://docs.unity3d.com/ScriptReference/RuntimePlatform.html

 

  • 전처리 소스 구분 코드

1

2

3

4

5

#if (UNITY_ANDROID || UNITY_IPHONE) 

    폰용 소스 

#else 

    다른 플랫폼 소스 

#endif 

cs

  • 비 전처리 소스 구분 코드

1

2

if (Application.platform == RuntimePlatform.WindowsPlayer)

    print ("Do something special here!");

cs

 

 

플랫폼 매크로 정의

Unity 스크립트에서 지원하는 플랫폼 매크로 정의 :

프로퍼티:

기능:

UNITY_EDITOR

Unity 스크립트에서 지원하는 플랫폼 매크로 정의 :

UNITY_EDITOR_WIN

Windows에서의 플랫폼 정의 에디터 코드.

UNITY_EDITOR_OSX

Mac OSX에서의 플랫폼 정의 에디터 코드.

UNITY_STANDALONE_OSX

Mac OS (Univeral, PPC 및 Intel 아키텍처 포함) 의 코드 컴파일 / 실행을 위한 플랫폼 매크로 정의.

UNITY_STANDALONE_WIN

Windows 독립 실행형 응용 프로그램 코드를 컴파일 / 실행하고 싶을 때 사용합니다.

UNITY_STANDALONE_LINUX

Linux 독립 실행형 응용 프로그램 코드를 컴파일 / 실행하고 싶을 때 사용합니다.

UNITY_STANDALONE

모든 독립 실행형 응용 프로그램(Mac, Windows 또는 Linux)의 코드를 컴파일 / 실행하고 싶을 때 사용합니다.

UNITY_WEBPLAYER

Web Player 콘텐츠(Windows 및 Mac Web Player 실행 파일을 포함합니다) 플랫폼 매크로 정의.

UNITY_WII

Wii 콘솔 코드 컴파일 / 실행을 위한 플랫폼 매크로 정의.

UNITY_IOS

iOS 플랫폼에서 코드 컴파일/실행을 위한 플랫폼 매크로 정의

UNITY_IPHONE

Deprecated. Use UNITY_IOS instead.

UNITY_ANDROID

Android 플랫폼의 플랫폼 매크로 정의.

UNITY_PS3

PlayStation 3에서 코드 컴파일 / 실행을 위한 플랫폼 매크로 정의.

UNITY_PS4

PlayStation 4에서 코드 컴파일 / 실행을 위한 플랫폼 매크로 정의.

UNITY_XBOX360

XBox 360 코드의 컴파일 / 실행을 위한 플랫폼 매크로 정의.

UNITY_XBOXONE

XBox One 코드의 컴파일 / 실행을 위한 플랫폼 매크로 정의.

UNITY_BLACKBERRY

Blackberry10 장치를 위한 플랫폼 매크로 정의.

UNITY_WP8

Windows Phone 8 플랫폼 매크로 정의.

UNITY_WP8_1

Windows Phone 8.1 플랫폼 매크로 정의.

UNITY_WSA

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

UNITY_WSA_8_0

SDK 8.0을 타케팅했을 때의 Windows Store Apps 플랫폼 매크로 정의.

UNITY_WSA_8_1

SDK 8.1을 타케팅했을 때의 Windows Store Apps 플랫폼 매크로 정의.

UNITY_WINRT

Equivalent to UNITY_WP8 | UNITY_WSA.

UNITY_WINRT_8_0

Equivalent to UNITY_WP8 | UNITY_WSA_8_0.

UNITY_WINRT_8_1

Equivalent to UNITY_WP_8_1 | UNITY_WSA_8_1. It's also defined when compiling against Universal SDK 8.1.

UNITY_WEBGL

WebGL 플랫폼 매크로 정의.

 

또한 작업을 하고 있는 Unity 엔진 ​​버전에 따라 코드를 선택적으로 컴파일할 수 있습니다. 현재 지원되고 있는 것은 :

 

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 버전의 플랫폼 매크로 정의.

UNITY_4_2

Unity 4.2 버전의 플랫폼 매크로 정의.

UNITY_4_3

Unity 4.3 버전의 플랫폼 매크로 정의.

UNITY_4_5

Unity 4.5 버전의 플랫폼 매크로 정의.

UNITY_4_6

Unity 4.6 버전의 플랫폼 매크로 정의.

UNITY_5_0

Unity 5.0 버전의 플랫폼 매크로 정의.

 

RuntimePlatform

 

OSXEditor

In the Unity editor on Mac OS X.

OSXPlayer

In the player on Mac OS X.

WindowsPlayer

In the player on Windows.

OSXWebPlayer

In the web player on Mac OS X.

OSXDashboardPlayer

In the Dashboard widget on Mac OS X.

WindowsWebPlayer

In the web player on Windows.

WindowsEditor

In the Unity editor on Windows.

IPhonePlayer

In the player on the iPhone.

XBOX360

In the player on the XBOX360.

PS3

In the player on the Play Station 3.

Android

In the player on Android devices.

LinuxPlayer

In the player on Linux.

WebGLPlayer

In the player on WebGL?

WSAPlayerX86

In the player on Windows Store Apps when CPU architecture is X86.

WSAPlayerX64

In the player on Windows Store Apps when CPU architecture is X64.

WSAPlayerARM

In the player on Windows Store Apps when CPU architecture is ARM.

WP8Player

In the player on Windows Phone 8 device.

TizenPlayer

In the player on Tizen.

PSP2

In the player on the PS Vita.

PS4

In the player on the Playstation 4.

XboxOne

In the player on Xbox One.

SamsungTVPlayer

In the player on Samsung Smart TV.

 

 

+ Recent posts