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 ();}}


,