SettingOnValueChangedAttribute
Binds a static method to OnValueChanged. Raised on global value settings; on a world path the method is bound invoke-only.
public sealed class SettingOnValueChangedAttribute : SettingListenerAttributeBinds a static method to the named setting's OnValueChanged event (IGlobalValueSetting<T>), which fires when the applied value changes. Required method signature: static void M(IValueModSetting<T> setting, T newValue). Pass includeInSync: true to have SyncSettingsToClass call the method with the setting's current SettingValue. OnValueChanged - its applied value arrives with the world rather than changing under the player - so on a world path the method is bound invoke-only: never raised, and run only by SyncSettingsToClass. That makes includeInSync: true mandatory there, or the method can never run at all.
Inheritance: Object → Attribute → SettingPathAttribute → SettingListenerAttribute → SettingOnValueChangedAttribute
Constructors
SettingOnValueChangedAttribute(String, Boolean)
public SettingOnValueChangedAttribute(string settingPath, bool includeInSync = false)Initializes the attribute with the setting path, and optionally opts the listener in to SyncSettingsToClass.
Properties
IncludeInSync
public bool IncludeInSync { get; }Gets whether SyncSettingsToClass calls this listener with the setting's current SettingValue. Defaults to false, which leaves the listener running only when its event fires.
SettingListenerAttribute
Base for attributes that bind a static method to a setting's event. The setting path must be in the form "tabName.CategoryName.SettingName" for global settings and "CategoryName.SettingName" for world settings.
SettingOnSelectedChangedAttribute
Binds a static method to OnSelectedChanged. Global and world value settings.