Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Question PropertyDrawer for Array Item Add Event.

Discussion in 'Immediate Mode GUI (IMGUI)' started by atmuc, May 19, 2023.

  1. atmuc


    Feb 28, 2011
    I made a custom property drawer for array. OnGUI function is called for each item in array. How can I write a PropertyDrawer to get item added/removed events?

    Code (CSharp):
    2. [OnCollectionChanged("OnTestListChanged")]
    3. public string[] TestList;
    5. [CustomPropertyDrawer(typeof(OnCollectionChangedAttribute))]
    6. public class OnCollectionChangedDrawer : PropertyDrawer
    7. {
    8.  public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    9. {
    10. }
    11. }