OnApplyRevertGUI()
Process the 'Apply' and 'Revert' buttons.
Read time 1 minuteLast updated 19 days ago
Definition
- Type: Method
- Namespace: UnityEditor.AssetImporters
- Assembly: UnityEditor
protected virtual bool OnApplyRevertGUI()
Returns
Type | Description |
|---|---|
| bool | Returns 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(); } } }}