Makes attribute affect collections instead of their items.
using UnityEditor; using UnityEditor.UIElements; using UnityEngine; using UnityEngine.UIElements;
public class Collection : MonoBehaviour { public int before; [GreenCollectionDrawer] public int[] collection; public int after; }
public class GreenCollectionDrawerAttribute : PropertyAttribute { public GreenCollectionDrawerAttribute() : base(true) { } }
[CustomPropertyDrawer(typeof(GreenCollectionDrawerAttribute))] public class GreenCollectionDrawer : PropertyDrawer { public override VisualElement CreatePropertyGUI(SerializedProperty property) { return new PropertyField(property) { style = { backgroundColor = Color.green } }; } }