Version: 2020.3

Editor.CreateInspectorGUI

切换到手册
public UIElements.VisualElement CreateInspectorGUI ();

描述

实现此方法以创建自定义 UIElements 检视面板。

可以在此方法中为特定对象类创建自己的自定义 UIElements 检视面板。

注意:此函数必须重载才能正常工作。

以下示例说明如何使用 override 创建自定义标签。

using UnityEngine;
using System.Collections;
using UnityEditor;

// Creates a custom Label on the inspector for all the scripts named ScriptName // Make sure you have a ScriptName script in your // project, else this will not work. [CustomEditor(typeof(ScriptName))] public class TestOnInspector : Editor { public override VisualElement CreateInspectorGUI() { return new Label("This is a Label in a Custom Editor"); } }