@@ -10,9 +10,16 @@ namespace Toolbox.Editor.Drawers
1010
1111 public class ReferencePickerAttributeDrawer : ToolboxSelfPropertyDrawer < ReferencePickerAttribute >
1212 {
13- private readonly TypeField typeField = new TypeField ( new TypeConstraintReference ( null ) ) ;
13+ private static readonly TypeConstraintContext sharedConstraint = new TypeConstraintReference ( null ) ;
14+ private static readonly TypeAppearanceContext sharedAppearance = new TypeAppearanceContext ( sharedConstraint , TypeGrouping . None , true ) ;
15+ private static readonly TypeField typeField = new TypeField ( sharedConstraint , sharedAppearance ) ;
1416
1517
18+ private void UpdateContexts ( ReferencePickerAttribute attribute )
19+ {
20+ sharedAppearance . TypeGrouping = attribute . TypeGrouping ;
21+ }
22+
1623 private void CreateTypeProperty ( SerializedProperty property , Type parentType )
1724 {
1825 TypeUtilities . TryGetTypeFromManagedReferenceFullTypeName ( property . managedReferenceFullTypename , out var currentType ) ;
@@ -72,7 +79,6 @@ private Type GetParentType(SerializedProperty property, ReferencePickerAttribute
7279 return propertyType ;
7380 }
7481
75-
7682 protected override void OnGuiSafe ( SerializedProperty property , GUIContent label , ReferencePickerAttribute attribute )
7783 {
7884 using ( var propertyScope = new PropertyScope ( property , label ) )
@@ -82,8 +88,10 @@ protected override void OnGuiSafe(SerializedProperty property, GUIContent label,
8288 return ;
8389 }
8490
85- EditorGUI . indentLevel ++ ;
91+ UpdateContexts ( attribute ) ;
8692 var parentType = GetParentType ( property , attribute ) ;
93+
94+ EditorGUI . indentLevel ++ ;
8795 CreateTypeProperty ( property , parentType ) ;
8896 ToolboxEditorGui . DrawPropertyChildren ( property ) ;
8997 EditorGUI . indentLevel -- ;
0 commit comments