- Home /
 
 
               Question by 
               theagemaway · Nov 08, 2018 at 08:59 AM · 
                uicustom editorpropertydrawer  
              
 
              PropertyDrawer inserting large space for list
Hello All,
I have a quite simple custom PropertyDrawer.
 [CustomPropertyDrawer (typeof (TextChoice))]
 class TextChoiceEditor : PropertyDrawer {
 
     public override void OnGUI (Rect position, SerializedProperty property, GUIContent label) {
 
         EditorGUILayout.PropertyField (property.FindPropertyRelative ("text"), new GUIContent("Flavor"), GUILayout.ExpandWidth (true));
 
 
         EditorGUILayout.PropertyField (property.FindPropertyRelative ("effects"), includeChildren: true);
     }
 }
 
               The class only has two properties: a string ("text") and a List ("effects") where ChoiceEffect is a simple struct of an enum and a vector3.
In the inspector, this displays a space between the size int field and the actual property. Specifically, one space for each element, as shown below.

Obviously this space is "occupied" by the list element labels "element 0, element 1, element 2" etc. But I've tried everything to my wit's end to get rid of this space, and I just can't!
Any ideas?
PS. if anyone knows of a guide on the googles that can teach me a bit more about writing a property drawer for the List class, I would love it :D
Thanks in advance!
 
                 
                unity.png 
                (46.2 kB) 
               
 
              
               Comment
              
 
               
              Your answer