Dynamic Lock/Unlock of Project Settings in UE5 – Best Practices?

Hi everyone,

I’m facing a challenge with our project’s settings management and I’d really appreciate some community input.

The Situation:

I have a settings class, UMyPluginSettings, which is registered in our project settings. I need to prevent users from modifying these settings while a specific Slate panel is active. Once the panel is closed, the settings should become editable again.

What I’ve Tried:

I’ve added meta = (DisableEditOnInstance) to my UPROPERTY fields in UMyPluginSettings.
This wasn’t sufficient since it prevent the settings to be changed when instanced, but since the settings are get with GetMutableDefault<UCoinHoardPluginSettings>(), this has no effect.

I then overrode the CanEditChange method in UMyPluginSettings to check a global lock via a singleton (FMyPluginSettingsManager):

bool UMyPluginSettings::CanEditChange(const FProperty* InProperty) const
{
  if (FMyPluginSettingsManager::Get().AreSettingsLocked())
  {
    return false;
  }
  return Super::CanEditChange(InProperty);
}

I implemented a singleton manager that uses a counter:

        class FMyPluginSettingsManager
        {
        public:
            static FMyPluginSettingsManager& Get()
            {
                static FMyPluginSettingsManagerInstance;
                return Instance;
            }
            
            void LockSettings() { ++LockCounter; }
            void UnlockSettings(const bool InbForceTheUnlock = false)
            {
                --LockCounter;
                if (LockCounter < 0 || InbForceTheUnlock)
                {
                    LockCounter = 0;
                }
            }
            bool AreSettingsLocked() const { return LockCounter > 0; }

        private:
            FMyPluginSettingsManager() = default;
            int32 LockCounter{ 0 };
        };

When my panel opens, I call LockSettings(), and when it closes, I call UnlockSettings().

The built-in Project Settings UI (which is based on a details view) caches the “read-only” state when it is first opened. Once a property is grayed out because of the lock, it never refreshes its state—even after I call UnlockSettings()—so the fields remain uneditable. I’ve attempted workarounds (such as calling Modify(), PreEditChange(), and PostEditChange() on the settings object) to force a refresh, but this does not work reliably with the built-in Project Settings UI.

My Question:

Is there a recommended way to achieve a “lock” on project settings during their usage?

Thanks in advance for your help.