I looked for it, but I couldn't find this one. It may be in code we do not have access to or I just overlooked it.
So only thing I can think of would be to save the setting in saved vars whenever it gets changed then reload the setting when needed.
Lua Code:
-- On setting change save the new value in saved vars:
local function OnsettingChanged(eventCode, system, settingId)
if system ~= SETTING_TYPE_UI then return end
if settingId == UI_SETTING_SHOW_FRAMERATE or setingId == UI_SETTING_SHOW_LATENCY then
local newVal = GetSetting_Bool(system, settingId)
-- save it in saved vars:
someSavedVars[settingId] = newVal
end
end
EVENT_MANAGER:RegisterForEvent(ADDON_NAME, EVENT_INTERFACE_SETTING_CHANGED, OnsettingChanged)
-- Reload the saved settings:
local function OnPlayerActivated()
local frameRateSetting = someSavedVars[UI_SETTING_SHOW_FRAMERATE]
local latencySetting = someSavedVars[UI_SETTING_SHOW_LATENCY]
SetSetting(SETTING_TYPE_UI, UI_SETTING_SHOW_FRAMERATE, tostring(frameRateSetting))
SetSetting(SETTING_TYPE_UI, UI_SETTING_SHOW_LATENCY, tostring(latencySetting))
end
EVENT_MANAGER:RegisterForEvent(ADDON_NAME, EVENT_PLAYER_ACTIVATED, OnPlayerActivated)