Editor 编辑器

Inherits from ScriptableObject

Base class to derive custom Editors from. Use this to create your own custom inspectors and editors for your objects.


Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script.
注意:这是一个编辑器类,如果想使用它你需要把它放到工程目录下的Assets/Editor文件夹下。编辑器类在UnityEditor命名空间下。所以当使用C#脚本时,你需要在脚本前面加上 "using UnityEditor"引用。

You can attach the Editor to a custom component by using the CustomEditor attribute.


JavaScript Example:

// This example shows a custom inspector for an
// object "MyPlayerEditor", which has two variables, vel (velocity) and ammo.
//显示一个对象MyPlayerEditor的自定义检视面板,其中有两个变量vel (velocity) 和 ammo
class MyPlayerEditor extends Editor {
	function OnInspectorGUI() {
		EditorGUILayout.BeginHorizontal ();
		EditorGUILayout.PrefixLabel ("Speed");
		target.vel = EditorGUILayout.Slider(target.vel, 0, 100);
		EditorGUILayout.EndHorizontal ();

		EditorGUILayout.BeginHorizontal ();
		EditorGUILayout.PrefixLabel ("Ammo");
		target.ammo = EditorGUILayout.IntField(target.ammo);
		EditorGUILayout.EndHorizontal ();



Messages Sent发送消息

Inherited members继承成员

Inherited Variables继承变量

Inherited Functions继承函数

Inherited Class Functions继承类函数

Inherited Messages Sent继承发送消息

Page last updated: 2011-6-28