1,unity中官方文档的一个操纵关键词 Platform Dependent Compilation
2,常用的预编译关键词
UNITY_EDITOR编辑器调用。
UNITY_STANDALONE_OSX专门为Mac OS(包括Universal,PPC和Intelarchitectures)平台的定义。
UNITY_DASHBOARD_WIDGETMac OS Dashboard widget (Mac OS仪表板小部件)。
UNITY_STANDALONE_WINWindows。
UNITY_STANDALONE_LINUXLinux的独立的应用程序。
UNITY_STANDALONE独立的平台(Mac,Windows或Linux)。
UNITY_WEBPLAYER网页播放器(包括Windows和Mac Web播放器可执行文件)。
UNITY_WIIWii游戏机平台。
UNITY_IPHONEiPhone平台。
UNITY_ANDROIDAndroid平台。
UNITY_PS3PlayStation 3。
UNITY_XBOX360Xbox360。
UNITY_NACL谷歌原生客户端(使用这个必须另外使用UNITY_WEBPLAYER)。
UNITY_FLASHAdobe Flash。
3,具体的运用
public class PlatformDefines : MonoBehaviour { void Start () { #if UNITY_EDITOR Debug.Log("Unity Editor"); #endif #if UNITY_IPHONE Debug.Log("Iphone"); #endif #if UNITY_STANDALONE_OSX Debug.Log("Stand Alone OSX"); #endif #if UNITY_STANDALONE_WIN Debug.Log("Stand Alone Windows"); #endif } }
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。