Skip to content

Game.UI.Widgets.FixedLengthAttribute

Assembly:
Assembly-CSharp

Namespace: Game.UI.Widgets

Type:
class

Base:
UnityEngine.PropertyAttribute

Summary:
A marker attribute (empty subclass of UnityEngine.PropertyAttribute) used to indicate that a collection/array field should be treated as having a fixed length in the Unity inspector. This attribute contains no logic by itself — it is intended to be read by a custom PropertyDrawer or editor code that enforces or displays a fixed-length collection in the inspector. Common usages: preventing changing the array size or drawing a fixed number of elements for UI configuration in Cities: Skylines 2 mods.


Fields

  • None
    This class declares no instance or static fields.

Properties

  • None
    No properties are defined on this attribute.

Constructors

  • public FixedLengthAttribute()
    Default parameterless constructor provided by the class. No initialization logic is performed.

Methods

  • None
    There are no methods defined. Behavior must be implemented by a corresponding PropertyDrawer or editor script that checks for this attribute.

Usage Example

using UnityEngine;
using Game.UI.Widgets;

public class ExampleComponent : MonoBehaviour
{
    // This indicates the inspector/editor should treat this array as fixed-length.
    [SerializeField, FixedLength]
    private int[] fixedSizeValues = new int[4];
}

Notes: - Because FixedLengthAttribute is empty, you must implement a custom PropertyDrawer (UnityEditor) or editor UI code that looks for this attribute and enforces the fixed-length behavior (e.g., hide the size field, prevent resizing, or clamp size changes). - This attribute is placed in the Game.UI.Widgets namespace and intended for use in Cities: Skylines 2 mod UI code.