Skip to content

Game.Settings.SettingsUIWarningAttribute

Assembly:
(assembly not specified)

Namespace: Game.Settings

Type: class

Base: System.Attribute

Summary:
Attribute applied to settings properties to specify a runtime check that can produce a UI warning. The attribute stores a Type that contains the check method and the name of the method to call. The UI or settings system is expected to use reflection to invoke the specified static method to determine whether a warning should be shown for that property.


Fields

  • public readonly System.Type checkType
    Holds the Type that contains the check method. The check method named by checkMethod is looked up on this Type (typically a static method).

  • public readonly System.String checkMethod
    Holds the name of the method on checkType to invoke to evaluate and/or produce a warning for the annotated property. The runtime/settings UI implementation will use this string to find the method via reflection.

Properties

  • None
    This attribute exposes no properties beyond its readonly fields.

Constructors

  • public SettingsUIWarningAttribute(System.Type checkType, System.String checkMethod)
    Creates a new attribute instance and assigns the Type that contains the check routine and the name of the check method. Both parameters are required.

Methods

  • None
    This attribute contains only data (fields) and no behavior (no methods).

Usage Example

public static class SettingsChecks
{
    // Example check method: returns a warning string or null/empty if no warning.
    // The actual signature expected by the UI system may vary; commonly it's a static method.
    public static string CheckMySettingWarning()
    {
        // perform checks and return a descriptive warning if needed
        bool problem = /* ... */;
        return problem ? "This setting may cause performance issues." : null;
    }
}

public class MySettings
{
    // Apply the attribute, pointing to the type and method that perform the check.
    [SettingsUIWarning(typeof(SettingsChecks), nameof(SettingsChecks.CheckMySettingWarning))]
    public int MySetting { get; set; }
}

Notes: - The exact expected signature and return type of the check method depend on the settings/UI implementation (commonly a static method that returns a warning string or a boolean). Use reflection to match the runtime's expectations.