Game.Settings.SettingsUISetterAttribute
Assembly: Assembly-CSharp
Namespace: Game.Settings
Type: class SettingsUISetterAttribute
Base: System.Attribute
Summary:
Attribute used to associate a settings property with a UI "setter" routine. Apply this attribute to a property to tell the settings UI system which type and method to call to apply or reflect that property's value in the UI. The attribute stores a Type (the type that contains the setter method) and a string (the name of the method). The runtime UI system is expected to locate and invoke the specified method when building or updating the settings UI. The attribute is inheritable (AttributeUsage targets Property and allows inheritance).
Fields
-
public readonly System.Type setterType
Stores the Type that declares the UI setter method. This Type is used by the settings UI code to find the method named by setterMethod. Typically this Type contains one or more static or instance methods that the settings UI will call. -
public readonly System.String setterMethod
Name of the method on setterType that the settings UI should call for this property. The method name is looked up via reflection by the settings system. The expected signature is determined by the settings UI implementation (commonly a static method that accepts the property's value or a control reference).
Properties
- None
Constructors
public SettingsUISetterAttribute(System.Type setterType, System.String setterMethod)
Creates a new SettingsUISetterAttribute specifying the type that contains the setter method and the method name to call. Both parameters are stored in the corresponding readonly fields.
Methods
- None
Usage Example
// Example helper type that contains UI setter methods
public static class MySettingsUIHelpers
{
// Example signature — actual required signature depends on the settings UI system.
public static void ApplyVolume(float value)
{
// update UI control or apply the value to the audio system
}
}
// Apply the attribute to a settings property.
// The settings UI will look for MySettingsUIHelpers.ApplyVolume when handling this property.
[Game.Settings.SettingsUISetter(typeof(MySettingsUIHelpers), "ApplyVolume")]
public float MusicVolume { get; set; }