在开发中,特别是unity的跨平台中,我们常常会在各个平台游走,如安卓版,苹果版,PC版……。在此不同的平台上,有可能我们须要做不同的操作。然而我们就能够用unity的自带的平台宏定义方式来做平台的推断。Unity帮我们定义了例如以下平台预处理:
名称 | 描写叙述 |
---|---|
UNITY_EDITOR | Define for calling Unity Editor scripts from your game code.定义从您的游戏代码中调用Unity编辑器脚本。 |
UNITY_STANDALONE_OSX | Platform define for compiling/executing code specifically for Mac OS (This includes Universal, PPC and Intel architectures).平台定义为Mac OS(包括通用、PPC和Intel架构)的编译/执行代码。 |
UNITY_DASHBOARD_WIDGET | Platform define when creating code for Mac OS dashboard widgets.在为Mac OS仪表板小部件创建代码时,平台定义了。 |
UNITY_STANDALONE_WIN | Use this when you want to compile/execute code for Windows stand alone applications.当您想要为Windows独立应用程序编译/执行代码时,请使用它。 |
UNITY_STANDALONE_LINUX | Use this when you want to compile/execute code for Linux stand alone applications.当您想要为Linux独立应用程序编译/执行代码时,请使用它。 |
UNITY_STANDALONE | Use this to compile/execute code for an |