스터디/Unity 2016. 8. 16. 23:50

[유니티] 플랫폼별 전처리기

피씨에서는 마우스나 키보드 인풋이고, 폰이나 타블렛에서는 터치 인풋을 받으려면 아래와 같이 플랫폼별로 다르게 작성해줘야함


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


using UnityEngine;

using System.Collections;


public class ClassName : MonoBehaviour {

  void Start () {


    #if UNITY_EDITOR

        Debug.Log("Unity Editor");

    #endif


    #if UNITY_IPHONE

        Debug.Log("Iphone");

    #endif

     #if UNITY_ANDROID

        Debug.Log(“Android");

    #endif


      #if UNITY_WEBPLAYER 

        Debug.Log(“web player");

     #endif


     #if UNITY_STANDALONE_OSX

       Debug.Log("Stand Alone OSX");

    #endif



  }            

}