Attributes

The Architecture Toolkit includes a few different C# attributes that are useful to customize the editor interface for custom data structures and behaviors without needing to write custom editor scripts.


[ConditionalShow]

Shows the field in the editor based on the state of another field.

// boolean condition
public bool useCustomValue;
[ConditionalShow(nameof(useCustomValue))]
public float customValue;
// enum condition
public Axis axis;
[ConditionalShow(nameof(axis), (int)Axis.X)]
public float x;
[ConditionalShow(nameof(axis), (int)Axis.Y)]
public float y;
[ConditionalShow(nameof(axis), (int)Axis.Z)]
public float z;

[ConditionalHide]

Hides the field in the editor based on the state of another field.

// boolean condition
public bool useDefaultValue;
[ConditionalHide(nameof(useDefaultValue))]
public float customValue;
// enum condition
public Option option;
[ConditionalHide(nameof(option), (int)Option.B)]
public float a;
[ConditionalHide(nameof(option), (int)Option.A)]
public float b;

[ReadOnly]

Prevents the field from being modified in the editor.

[ReadOnly]
public string info;

[Rename]

Renames the field in the editor.

[Rename("Custom Toggle")]
public bool toggle;