Gears
API ReferenceAttributes

SettingAttribute

Binds a static field or property to the setting its path names. Pass the declaring type to BindSettingsClass and the member is assigned the resolved setting. A field must be static and neither readonly nor const; a property must be static and have a setter, which may be private.

Sealed classNamespace GearsAPI.AttributesAssembly GearsAPI.dllSource
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
public sealed class SettingAttribute : SettingPathAttribute

BindSettingsClass assigns the resolved setting into the member before it subscribes any listener on the same type. The member's declared type must be one the setting actually implements — anything from IModSetting down to the concrete class. Anything else is logged and skipped. See the Bind Settings with Attributes guide.

Inheritance: Object → Attribute → SettingPathAttribute → SettingAttribute
Attributes: AttributeUsageAttribute

Constructors

SettingAttribute(String)

public SettingAttribute(string settingPath)

Initializes the attribute with the setting path.

On this page