赞
踩
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
提示:这里可以添加本文要记录的大概内容:
链接: 官方文档
Unity automatically defines certain scripting symbols based on the authoring and build target platform. These are as follows:
Define | 功能 |
---|---|
UNITY_EDITOR | Unity编辑器 |
UNITY_EDITOR_WIN | 在Windows上用于编辑器代码的脚本符号 |
UNITY_EDITOR_OSX | 用于Mac oS X上编辑器代码的脚本符号 |
UNITY_EDITOR_LINUX | Linux上编辑器代码的脚本符号 |
UNITY_STANDALONE_OSX | Scripting symbol to compile or execute code specifically for Mac OS X (including Universal, PPC and Intel architectures). |
UNITY_STANDALONE_WIN | Scripting symbol for compiling/executing code specifically for Windows standalone applications. |
UNITY_STANDALONE_LINUX | Scripting symbol for compiling/executing code specifically for Linux standalone applications. |
UNITY_STANDALONE | – |
UNITY_WII | – |
UNITY_IOS | |
UNITY_ANDROID | – |
UNITY_LUMIN | – |
UNITY_TIZEN | – |
UNITY_TVOS | – |
UNITY_WSA | – |
UNITY_WSA_10_0 | – |
UNITY_WEBGL | – |
using UnityEngine;
using System.Collections;
public class PlatformDefines : MonoBehaviour {
void Start () {
#if UNITY_EDITOR
Debug.Log("Unity Editor");
#endif
#if UNITY_IOS
Debug.Log("iOS");
#endif
#if UNITY_STANDALONE_OSX
Debug.Log("Standalone OSX");
#endif
#if UNITY_STANDALONE_WIN
Debug.Log("Standalone Windows");
#endif
}
}
提示:这里对文章进行总结:
本文仅仅简单介绍了平台编译预定义的使用,而平台编译预定义提供了大量能使我们快速便捷地处理方法。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。