OnInspectorUpdate 每秒调用 10 帧,以便检查器有机会更新。有关更多详细信息,请参阅 EditorWindow.OnInspectorUpdate。
using UnityEditor; public static class PresetManagerHelper { [SettingsProvider] static SettingsProvider CreatePresetManagerProvider() { var provider = AssetSettingsProvider.CreateProviderFromAssetPath( "Project/Preset Manager", "ProjectSettings/PresetManager.asset"); provider.inspectorUpdateHandler += () => { // When PresetManager is updated from the inspector, check to see if we need to update the Preset Settings View. if (provider.settingsEditor != null && provider.settingsEditor.serializedObject.UpdateIfRequiredOrScript()) { provider.Repaint(); } }; return provider; } }