I’m trying to make a custom property drawer for arrays/lists to be able to draw them like this editor window:
[AttributeUsage(AttributeTargets.Field)]
public class AwesomeCollectionAttribute : PropertyAttribute
{
}
public class TestMB : MonoBehaviour
{
[AwesomeCollection][SerializeField]
private List<Transform> waypoints; // also tried Transform[] - same.
}
[CustomPropertyDrawer(typeof(AwesomeCollectionAttribute))]
public class AwesomeCollectionDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
}
}
No matter what, Unity will always draw the default array “things” (the fold, the size and the elements) - I don’t want that.
If I tag the field with [HideInInspector]
then this will hide any GUI-related thing I do in the OnGUI
(GUI.Label, etc)
Again, what I’m trying to do is, see that editor window at the top? I’m trying to write a property drawer that would draw arrays/lists just like that window.
Any ideas how to override that default drawing and get what I want?
Thanks.