Gears
API ReferenceAttributes

SettingFormatterAttribute

Marks a static method as the formatter for a value type.

Sealed classNamespace GearsAPI.AttributesAssembly GearsAPI.dllSource
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public sealed class SettingFormatterAttribute : Attribute

Marks a static method inside a SettingsSerializationProvider class as the formatter for a value type. The method must have the signature static string Method(T value, string format), where format is the setting's UI or serialization formatter string and may be null; a mismatch throws InvalidOperationException when Gears scans it. One formatter is registered per value type across the whole game, and the last one scanned wins. Registering a type Gears already handles replaces its handler, and two mods registering the same type silently overwrite each other, so register only types your own mod owns.

Inheritance: Object → Attribute → SettingFormatterAttribute
Attributes: AttributeUsageAttribute

Constructors

SettingFormatterAttribute(Type)

public SettingFormatterAttribute(Type valueType)

Initializes the attribute for valueType.

Properties

ValueType

public Type ValueType { get; }

Gets the type the method formats.

On this page