Application.isEditor 是否编辑器

static var isEditor : bool

Description描述

Are we running inside the Unity editor? (Read Only)

是在Unity编辑器内运行?

Returns true if the game is being run from the Unity editor; false if run from any deployment target.

如果游戏从Unity编辑器中运行,返回真;如果从其他部署目标运行返回假。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		if (Application.isEditor)
			print("We are running this from inside of the editor!");

	}
}
if (Application.isEditor) {
	print("We are running this from inside of the editor!");
}
最后修改:2010年12月14日 Tuesday 22:27

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。