Editor.DrawDefaultInspector 绘制默认检视面板

function DrawDefaultInspector () : bool

Description描述

Draw the built-in inspector.

绘制内置检视面板。

Call this function from inside OnInspectorGUI to let draw the automatic inspector. Useful if you only want to add a few buttons to an inspector, but don't want to redo the entire one.

从OnInspectorGUI调用这个函数,来绘制自动检视面板。通常就是只想在检视面板添加几个按钮,但不想重做整个。

参见:OnInspectorGUI

// 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.LabelField ("Some help", "Some other text");

		EditorGUILayout.BeginHorizontal ();
		EditorGUILayout.PrefixLabel ("Speed");
		target.vel = EditorGUILayout.Slider (target.vel, 0, 100);
		EditorGUILayout.EndHorizontal ();

		// Show default inspector property editor
		//显示默认检视面板属性编辑器
		DrawDefaultInspector ();
	}
}
最后修改:2011年6月28日 Tuesday 8:54

本脚本参考基于Unity 3.4.1f5

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