Bootstrap

unity平台的预处理 转载

  1. using UnityEngine;  
  2. using System.Collections;  
  3.   
  4. public class Recompile : MonoBehaviour  
  5. {  
  6.   
  7.     private string platform = string.Empty;  
  8.     // Use this for initialization  
  9.     void Start()  
  10.     {  
  11.         DebugPlatformMesaage();  
  12.     }  
  13.   
  14.     void DebugPlatformMesaage()  
  15.     {  
  16.  
  17. #if UNITY_EDITOR  
  18.         platform = "hi,大家好,我是在unity编辑模式下";  
  19. #elif UNITY_XBOX360  
  20.        platform="hi,大家好,我在XBOX360平台";  
  21. #elif UNITY_IPHONE  
  22.        platform="hi,大家好,我是IPHONE平台";  
  23. #elif UNITY_ANDROID  
  24.        platform="hi,大家好,我是ANDROID平台";  
  25. #elif UNITY_STANDALONE_OSX  
  26.        platform="hi,大家好,我是OSX平台";  
  27. #elif UNITY_STANDALONE_WIN  
  28.        platform="hi,大家好,我是Windows平台";  
  29. #endif  
  30.         Debug.Log("Current Platform:" + platform);  
  31.     }  
  32. }  
;