Game.Settings.SettingsUIPathAttribute
Assembly:
Assembly-CSharp (typical Unity/game assembly; verify in your mod/game project)
Namespace: Game.Settings
Type:
class
Base:
System.Attribute
Summary:
Attribute that can be applied to properties to specify a UI path override used by settings UI builders or serializers. The attribute is declared with AttributeUsage(AttributeTargets.Property, Inherited = true), so it targets properties and is inherited by derived types. Intended to carry a string path that UI code can read via reflection to place or group the property in the settings UI.
Fields
public readonly string path
Holds the path string provided when the attribute is constructed. This value is intended to be read by UI/layout code (via reflection) to determine where or how to display the annotated property in settings UI.
Properties
- (none)
Constructors
public SettingsUIPathAttribute(string overridePath)
Creates the attribute and sets the readonly path field. The overridePath parameter is the path string that UI code should use as an override or grouping key for the annotated property.
Methods
- (none)
Usage Example
using Game.Settings;
public class GraphicsSettings
{
// Place this property under the "Graphics/Display" path in the settings UI
[SettingsUIPath("Graphics/Display")]
public int ScreenResolution { get; set; }
// Inherited usage:
// If a derived class reuses this property, the attribute is inherited due to AttributeUsage(Inherited = true)
}
// Example of reading the attribute via reflection:
var prop = typeof(GraphicsSettings).GetProperty(nameof(GraphicsSettings.ScreenResolution));
var attr = (SettingsUIPathAttribute)Attribute.GetCustomAttribute(prop, typeof(SettingsUIPathAttribute));
if (attr != null)
{
string uiPath = attr.path;
// Use uiPath to place the property in the UI layout, e.g. "Graphics/Display"
}
Notes: - The attribute is simple and contains only a readonly string. Consumers (UI builders) must use reflection to read the path. - Confirm the assembly name in your project if you need exact assembly metadata.