Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit a9f46bc

Browse files
authored
Merge pull request #300 from silentlamb1991/patch-2
Added support for Space & Header attribute
2 parents cebe5aa + b7cc7ea commit a9f46bc

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

PostProcessing/Editor/PostProcessEffectBaseEditor.cs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,32 @@ protected void PropertyField(SerializedParameterOverride property, GUIContent ti
107107
title.tooltip = tooltipAttr.tooltip;
108108
}
109109

110-
// Look for a compatible attribute decorator and break as soon as we find one
110+
// Look for a compatible attribute decorator
111111
AttributeDecorator decorator = null;
112112
Attribute attribute = null;
113113

114114
foreach (var attr in property.attributes)
115115
{
116-
decorator = EditorUtilities.GetDecorator(attr.GetType());
117-
attribute = attr;
116+
// Use the first decorator we found
117+
if (decorator == null)
118+
{
119+
decorator = EditorUtilities.GetDecorator(attr.GetType());
120+
attribute = attr;
121+
}
118122

119-
if (decorator != null)
120-
break;
123+
// Draw unity built-in Decorators (Space, Header)
124+
if (attr is PropertyAttribute)
125+
{
126+
if (attr is SpaceAttribute)
127+
EditorGUILayout.GetControlRect(false, (attr as SpaceAttribute).height);
128+
else if (attr is HeaderAttribute)
129+
{
130+
var rect = EditorGUILayout.GetControlRect(false, 24f);
131+
rect.y += 8f;
132+
rect = EditorGUI.IndentedRect(rect);
133+
EditorGUI.LabelField(rect, (attr as HeaderAttribute).header, EditorStyles.miniBoldLabel);
134+
}
135+
}
121136
}
122137

123138
bool invalidProp = false;

0 commit comments

Comments
 (0)