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!");
}
Page last updated: 2010-12-14