Experimental: this API is experimental and might be changed or removed in the future.

AssetImporterEditor.ApplyRevertGUI

切换到手册
protected void ApplyRevertGUI ();

描述

向编辑器添加“Apply”和“Revert”按钮。

从 OnInstpectorGUI 事件处理程序方法调用,因为这是 Apply/Revert 按钮在编辑器中的放置位置。 此方法不能重载,但可以通过重新实现 OnApplyRevertGUI 事件处理程序方法注入自定义行为。

using UnityEngine;
using UnityEditor;
using UnityEditor.Experimental.AssetImporters;

public class ExampleScript : ScriptedImporterEditor { public override void OnInspectorGUI() { serializedObject.Update();

// Draw custom GUI

serializedObject.ApplyModifiedProperties();

ApplyRevertGUI(); } }