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

AssetImporterEditor.OnApplyRevertGUI

マニュアルに切り替える
protected bool OnApplyRevertGUI ();

戻り値

bool Returns true if the new settings were successfully applied.

説明

Process the 'Apply' and 'Revert' buttons.

This is called by ApplyRevertGUI to place and handle the 'Apply' and 'Revert' buttons.

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

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

// Draw custom GUI

serializedObject.ApplyModifiedProperties(); ApplyRevertGUI(); }

private bool CanApply() { // Add custom checks that make sure the Importer is in a valid state to be applied. return false; }

protected virtual bool OnApplyRevertGUI() { using (new EditorGUI.DisabledScope(!HasModified())) { RevertButton(); using (new EditorGUI.DisabledScope(!CanApply())) { return ApplyButton(); } } } }