- Home /
CustomPropertyDrawer of a Generic List.
Hi, I want to custom all the Lists that appears in my code with a Custom Drawer (For example, to change the add and minus button behaviors, etc).
But, when decorating a list with some PropertyAttribute, the method OnGUI returns the SerializedProperty of each element in the list, and not the list itself, preventing to create a Reorderable list (which provides a basic functionality to manage the list in the editor).
After some investigation I found the best solution is to make a custom class MYLIST which is a List Wrapper, and create a custom drawer for it.
BUUUT, in the asset store you can find example of Custom attributes applied directly to generic List<>: https://assetstore.unity.com/packages/tools/gui/reorderable-list-attribute-139001
Any idea of how to do that ?
Thanks in advance.
Answer by Bunny83 · Aug 18, 2021 at 01:26 PM
Well, Unity's default inspector behaviour does not allow that. Most solutions ship their own default inspector replacement like this one for example. As you can see this custom editor is used for all UnityEngine.Object derived types unless there's a more specific inspector defined for a more specific type.