Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


OnApplyRevertGUI()

Process the 'Apply' and 'Revert' buttons.
Read time 1 minuteLast updated 19 days ago

Definition

protected virtual bool OnApplyRevertGUI()

Returns

Type

Description

boolReturns true if the new settings were successfully applied.

Remarks

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

Examples

using UnityEngine;using UnityEditor;using UnityEditor.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(); } } }}