Skip to content

Commit 38abfb3

Browse files
committed
Possibility to apply Order and conditions to the TitleAttribute
1 parent 3afc83d commit 38abfb3

File tree

1 file changed

+18
-2
lines changed
  • Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ArchetypeAttributes

1 file changed

+18
-2
lines changed

Assets/Editor Toolbox/Runtime/Attributes/Toolbox/ArchetypeAttributes/TitleAttribute.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace UnityEngine
88
{
99
/// <summary>
1010
/// Standardized header, it's composition of the <see cref="LabelAttribute"/> and the <see cref="LineAttribute"/>.
11+
/// <para><see cref="LineAttribute"/> is always created with <see cref="Order"/> + 1.</para>
1112
/// </summary>
1213
[AttributeUsage(AttributeTargets.Field, AllowMultiple = true)]
1314
[Conditional("UNITY_EDITOR")]
@@ -27,17 +28,32 @@ public override ToolboxAttribute[] Process()
2728
new LabelAttribute(Label)
2829
{
2930
#if UNITY_EDITOR
30-
SpaceAfter = -EditorGUIUtility.standardVerticalSpacing
31+
SpaceAfter = -EditorGUIUtility.standardVerticalSpacing,
3132
#endif
33+
Order = Order,
34+
ApplyCondition = ApplyCondition
3235
},
3336
new LineAttribute(padding: 0)
3437
{
35-
ApplyIndent = true
38+
ApplyIndent = true,
39+
Order = Order + 1,
40+
ApplyCondition = ApplyCondition
3641
}
3742
};
3843
}
3944

4045

4146
public string Label { get; private set; }
47+
48+
/// <summary>
49+
/// Order of the decorator relative to other drawers on the same property.
50+
/// </summary>
51+
public int Order { get; set; }
52+
53+
/// <summary>
54+
/// Indicates if decorator should be created independly to state of the property.
55+
/// If <see cref="ApplyCondition"/> equals <see langword="true"/> it means that the decorator can be hidden/disabled same as an associated property.
56+
/// </summary>
57+
public bool ApplyCondition { get; set; }
4258
}
4359
}

0 commit comments

Comments
 (0)