Expanding a custom property drawer of a list item forces further items in the list to disappear.

(I posted this question in the forums, but I think it doesn’t have such visibility as here).

I made a custom Drawer of a class (Item). And another class containing a list of those items (ItemList).

The inspector show this:

185680-129571745-f17e3443-1c2d-409f-b5a4-622524e39969.png

But when expanding some element, the others get faded out:

185681-129571910-270eca25-76a8-4d19-89c8-1fbe8d874502.png

This is a minimal reproducible example (deleting the CustomPropertyDrawer makes it work though, but deleting the Drawer is not an option in my production code).

`
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

public class ItemList : MonoBehaviour
{
public Item ListOfItems;
}

[System.Serializable]
public class Item
{
public string _Name;
}

#if UNITY_EDITOR
[CustomPropertyDrawer(typeof(Item))]
public class ItemDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginProperty(position, label, property);
EditorGUI.PropertyField(position, property, label, true);
EditorGUI.EndProperty();
}

public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
    float height = EditorGUI.GetPropertyHeight(property, label, true);
    return height;
}

}
#endif
`

Thanks for considering my request.

Uhm, I just copied your code varbatim to my test project and I get:

185682-listelementpropertydrawer.png

So you either have some dodgy serialized data which may mess up your property (though in such a case I would expect to see some errors or warnings in the console), or the code you’ve posted is not the code you’re using. Are you sure there are no compiler errors at all in your whole project?

ps: It seems really weird to have an int variable called “name”.

Found it, within an empty project, it works in 2020.3 but not in 2021.1