Gears
API ReferenceAttributes

SettingOnSelectedChangedAttribute

Binds a static method to OnSelectedChanged. Global and world value settings.

Sealed classNamespace GearsAPI.AttributesAssembly GearsAPI.dllSource
public sealed class SettingOnSelectedChangedAttribute : SettingListenerAttribute

Binds a static method to the named setting's OnSelectedChanged event (IValueModSetting<T>), which fires when the value selected in the UI changes. Global and world value settings. 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 SelectedValue.

Inheritance: Object → Attribute → SettingPathAttribute → SettingListenerAttribute → SettingOnSelectedChangedAttribute

Constructors

SettingOnSelectedChangedAttribute(String, Boolean)

public SettingOnSelectedChangedAttribute(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 SelectedValue. Defaults to false, which leaves the listener running only when its event fires.

On this page