Game.Settings.SettingsUIValueVersionAttribute
Assembly: Assembly-CSharp (typical for game mods)
Namespace: Game.Settings
Type: class
Base: System.Attribute
Summary:
Attribute applied to a settings property to point to a separate type and method that supply a "version" token for that UI value. The attribute records the Type that contains the version-getter method and the name of that method. The settings UI (or serialization/compatibility code) can call that method to determine a version identifier for the property's value, allowing version-aware UI, migration, or compatibility handling.
This attribute is declared with AttributeUsage(AttributeTargets.Property, Inherited = true), so it targets properties and supports inheritance.
Fields
-
public readonly System.Type versionGetterType
Holds the Type that contains the method used to obtain the version for the associated property. Typically this points to a helper or provider type that exposes a static method to return a version token. -
public readonly System.String versionGetterMethod
Holds the name of the method on versionGetterType that should be invoked to retrieve the version token. The method name must match exactly and be accessible when invoked (commonly a public static parameterless method).
Properties
- None.
Constructors
public SettingsUIValueVersionAttribute(System.Type versionGetterType, System.String versionGetterMethod)
Initializes a new instance of the attribute with the specified provider type and method name. Both parameters are stored in the readonly fields above. Use this constructor to link a settings property to a method that returns its version token.
Methods
- None (no instance or helper methods on the attribute itself).
Usage Example
// Example provider type that returns a version token for a UI value
public static class MySettingsVersionProvider
{
// Could return int, string, or other token used by the settings system.
public static int GetMyValueVersion()
{
return 2;
}
}
// Example usage on a settings property
public class MySettings
{
[SettingsUIValueVersionAttribute(typeof(MySettingsVersionProvider), "GetMyValueVersion")]
public int SomeSetting { get; set; }
}
Additional notes: - The attribute does not perform the method invocation itself; it only records where to find the method. The settings/UI system must reflectively locate and call the specified method at runtime. - Ensure the target method's accessibility (public/static) and signature meet the expectations of the caller in your mod or the game's settings code.