What is the macro definition: it is to execute different code in different environments, such as executing different code on the Android platform and on the Apple platform, so that you can compile the code specifically for your target platform
Are there any built-in macros in Unity?
- UNITY_EDITOR called in the Unity editor
- UNITY_ANDROID Android Platform
- UNITY_IPHONE Apple platform.
grammar
#if UNITY_EDITOR youkeBtn.gameObject.SetActive(false); weChatBtn.gameObject.SetActive(true); #endif #if UNITY_ANDROID || UNITY_IPHONE youkeBtn.gameObject.SetActive(true); weChatBtn.gameObject.SetActive(false); #endif #if UNITY_STANDALONE Debig.Log("PC平台(包括window,Mac,Linux)") #endif
custom macro definition
- Set in OtherSetting under Unity's PlayerSetting. After setting, you need to click the Enter key to take effect.
- Set in OtherSetting under Unity's PlayerSetting. After setting, you need to click the Enter key to take effect.
Unity macro definition
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=325543540&siteId=291194637
Ranking