Skip to content

Commit 82054cd

Browse files
committed
Added workaround for drawer labels with PropertyFields
1 parent 4b96dab commit 82054cd

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Assets/com.alelievr.NodeGraphProcessor/Editor/Resources/GraphProcessorStyles/BaseNodeView.uss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,4 +247,10 @@ ParameterNodeView #controls EnumField > VisualElement > VisualElement {
247247
width: 16px;
248248
height: 16px;
249249
margin: 4px;
250+
}
251+
252+
/* In Unity 2020.3, we need to manually hide labels of property fields with empty label */
253+
.DrawerField_2020_3 > * > Label
254+
{
255+
display: none;
250256
}

Assets/com.alelievr.NodeGraphProcessor/Editor/Views/BaseNodeView.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,11 @@ protected VisualElement AddControlField(FieldInfo field, string label = null, bo
841841
var element = new PropertyField(FindSerializedProperty(field.Name), showInputDrawer ? "" : label);
842842
element.Bind(owner.serializedGraph);
843843

844+
#if UNITY_2020_3 // In Unity 2020.3 the empty label on property field doesn't hide it, so we do it manually
845+
if (showInputDrawer && element != null)
846+
element.AddToClassList("DrawerField_2020_3");
847+
#endif
848+
844849
element.RegisterValueChangeCallback(e => {
845850
UpdateFieldVisibility(field.Name, field.GetValue(nodeTarget));
846851
});

0 commit comments

Comments
 (0)