Version: 2017.1

Editor.DrawDefaultInspector

切换到手册
public bool DrawDefaultInspector ();

描述

绘制内置检视面板。

在 OnInspectorGUI 方法中调用此函数可绘制自动检视面板。 如果您不想重新绘制整个检视面板,但又想向其中添加一些按钮, 则可以使用此方法。

另请参阅:OnInspectorGUI

// This example shows a custom inspector for an
// object "MyPlayer", which has a variable speed.
using UnityEngine;
using UnityEditor;
using System.Collections;

[CustomEditor(typeof(MyPlayer))] public class Example : Editor { public override void OnInspectorGUI() { MyPlayer targetPlayer = (MyPlayer)target; EditorGUILayout.LabelField ("Some help", "Some other text");

targetPlayer.speed = EditorGUILayout.Slider ("Speed", targetPlayer.speed, 0, 100);

// Show default inspector property editor DrawDefaultInspector (); } }