# 조건부 컴파일 테스트

> Code example and steps to test your conditionally compiled code.

다음 예시는 조건부로 컴파일된 코드를 테스트하는 방법을 보여 줍니다. 또한 타겟 빌드에 대해 선택한 플랫폼에 따라 메시지를 출력합니다.

## 샘플 코드##sample-code

```lang-csharp

using UnityEngine;
using System.Collections;
public class PlatformDefines : MonoBehaviour {
void Start () {

  #if UNITY_EDITOR
    Debug.Log("Unity Editor");
  #endif

  #if UNITY_IOS
    Debug.Log("Unity iOS");
  #endif

  #if UNITY_STANDALONE_OSX
      Debug.Log("Standalone OSX");
  #endif

  #if UNITY_STANDALONE_WIN
    Debug.Log("Standalone Windows");
  #endif

}			 
} 
```

## 테스트 지침##test-instructions

1. **Build Profiles** 창(메뉴: **File** > **Build Profiles**)을 엽니다.
2. 코드를 테스트할 플랫폼이 활성화된 플랫폼 프로필인지 확인합니다. 그렇지 않으면 원하는 플랫폼을 선택한 뒤 **Switch Profile**을 클릭합니다.
3. [스크립트](/engine/6000.0/manual/scripting/get-started/creating-scripts.md)를 생성한 후 [샘플 코드](#Sample)를 복사해 붙여 넣습니다.
4. [게임 뷰](/engine/6000.0/manual/unity-editor/using-the-editor/game-view.md) 툴바에서 플레이 버튼을 눌러 플레이 모드를 시작합니다. Unity 콘솔에서 선택한 플랫폼에 해당하는 메시지를 확인하여 코드가 작동하는지 확인합니다. 예를 들어 iOS를 선택했다면 `Unity Editor`와 `Unity iOS` 메시지가 콘솔에 나타납니다.

## 추가 리소스##additional-resources

* [Unity 스크립팅 심볼 레퍼런스](/engine/6000.0/manual/scripting/compilation-and-code-reload/script-compilation/conditional-compilation/symbol-reference.md)
* [커스텀 스크립팅 심볼](/engine/6000.0/manual/scripting/compilation-and-code-reload/script-compilation/conditional-compilation/custom-scripting-symbols.md)
