Debug.isDebugBuild 是否调试版本
static var isDebugBuild : bool
Description描述
In the Build Settings dialog there is a check box called "Development Build".
在Build Settings对话框有个Debug Build复选框。
If it is checked isDebugBuild will be off. In the editor isDebugBuild always returns true. It is recommended to remove all calls to Debug.Log when deploying a game, this way you can easily deploy beta builds with debug prints and final builds without.
如果复选框被选择,isDebugBuild将是关闭的。在编辑器isDebugBuild总是返回true。建议发布游戏的时候移除所有Debug.Log调用。这样,你就可以很容易的发布带有调试输出的测试版,并且最终版没有。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public void Awake() {
if (Debug.isDebugBuild)
Debug.Log("This is a debug build!");
}
}
// Log some debug information only if this is a debug build
//只有这是调试版时,记录调式信息
if (Debug.isDebugBuild) {
Debug.Log ("This is a debug build!");
}
最后修改:2010年12月24日 Friday 22:15