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.
你可以附加该编辑器到一个自定义组件,通过使用CustomEditor属性。
JavaScript Example:
// This example shows a custom inspector for an
// object "MyPlayerEditor", which has two variables, vel (velocity) and ammo.
//显示一个对象MyPlayerEditor的自定义检视面板,其中有两个变量vel (velocity) 和 ammo
@CustomEditor(MyPlayerEditor)
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 ();
}
}
Variables变量
-
The object being inspected. // 受检查的对象。
Functions函数
-
Draw the built-in inspector. //绘制内置检视面板。
-
Implement this function to make a custom inspector.
执行这个函数来一个自定义检视面板。 -
Repaint any inspectors that shows this editor.
重绘显示在这个编辑器的任何检视面板。 -
Override this method in subclasses if you implement OnPreviewGUI.
如果执行OnPreviewGUI,在子类重写这个方法。 -
Implement this method in a subclass if you want to have a preview field in the inspector.
如果你想在检视面板有一个预览字段,在子类执行这个方法。 -
Override this method if you want to show custom controls in the preview header.
如果你想在预览头显示自定义控件,重新这个方法。 -
Implement this method to show asset information on top of the asset preview.
执行这个方法来显示资源信息在资源预览的顶部。
Messages Sent发送消息
-
Lets the Editor handle an event in the scene view.
让编辑器在场景视图处理一个事件。
Inherited members继承成员
Inherited Variables继承变量
-
The name of the object. //物体的名字
-
Should the object be hidden, saved with the scene or modifiable by the user?
物体是否被隐藏、保存在场景中或被用户修改?
Inherited Functions继承函数
-
Returns the instance id of the object.
返回物体的实例ID -
Returns the name of the game object.
返回游戏物体的名称。
Inherited Class Functions继承类函数
-
Creates an instance of a scriptable object with className.
创建一个名为className的脚本化对象的一个实例。 -
Creates an instance of a scriptable object with T.
创建一个带有T参数脚本化对象的实例。
-
Does the object exist?
物体是否存在? -
Clones the object original and returns the clone.
克隆原始物体,并返回克隆的物体 -
-
Removes a gameobject, component or asset.
删除一个游戏物体、组件或资源 -
Destroys the object obj immediately. It is strongly recommended to use Destroy instead.
立即销毁物体obj,强烈建议使用Destroy代替。 -
Returns a list of all active loaded objects of Type type.
返回Type类型的所有激活的加载的物体列表 -
Returns the first active loaded object of Type type.
返回Type类型第一个激活的加载的物体。 -
Compares if two objects refer to the same
比较如果两个物体相同 -
Compares if two objects refer to a different object
比较如果两个物体不同 -
Makes the object target not be destroyed automatically when loading a new scene.
加载新场景的时候使目标物体不被自动销毁。
Inherited Messages Sent继承发送消息
-
Creates an instance of a scriptable object with T.
创建一脚本化对象T的一个实例。 -
This function is called when the scriptable object goes out of scope
当脚本化对象超出范围时调用这个函数。 -
This function is called when the scriptable object will be destroyed.
当脚本化对象将被销毁,这个函数被调用。
最后修改:2011年6月28日 Tuesday 11:48