title: How to select elements in nested ReorderableList in a CustomEditor?
body: <p>I have a <a href="https://github.com/Unity-Technologies/UnityCsReference/blob/master/Editor/Mono/GUI/ReorderableList.cs" rel="noreferrer"><code>ReorderableList</code></a> in my <code>CustomEditor</code> script. In the <code>drawElementCallback</code> I added a second nested <code>ReorderableList</code>. Everything works fine and I can add elements to both lists like here</p>
  
  <p><a href="https://i.stack.imgur.com/OQVub.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/OQVub.gif" alt="enter image description here"></a></p>
  
  <p><strong>BUT</strong> as you can see for some reason I can not select the elements of the inner <code>ReorderableList</code>s so I also can not remove items.</p>
  
  <p><strong>How can I select items in the inner list?</strong></p>
  
  <hr>
  
  <p>Here the classes broken down to the basic example</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using UnityEditor;
  using UnityEditorInternal;
  using UnityEngine;
  
  [Serializable]
  public class SomeClass
  {
      public string Name;
      public List&lt;SomeClass&gt; InnerList;
  }
  
  [CreateAssetMenu(menuName = "Example", fileName = "new Example Asset")]
  public class Example : ScriptableObject
  {
      public List&lt;SomeClass&gt; SomeClasses;
  
      [CustomEditor(typeof(Example))]
      private class ModuleDrawer : Editor
      {
          private SerializedProperty SomeClasses;
          private ReorderableList list;
  
          private void OnEnable()
          {
              SomeClasses = serializedObject.FindProperty("SomeClasses");
  
              // setupt the outer list
              list = new ReorderableList(serializedObject, SomeClasses)
              {
                  displayAdd = true,
                  displayRemove = true,
                  draggable = true,
  
                  drawHeaderCallback = rect =&gt;
                  {
                      EditorGUI.LabelField(rect, "Outer List");
                  },
  
                  drawElementCallback = (rect, index, a, h) =&gt;
                  {
                      // get outer element
                      var element = SomeClasses.GetArrayElementAtIndex(index);
  
                      var InnerList = element.FindPropertyRelative("InnerList");
  
                      // Setup the inner list
                      var innerReorderableList = new ReorderableList(element.serializedObject, InnerList)
                      {
                          displayAdd = true,
                          displayRemove = true,
                          draggable = true,
  
                          drawHeaderCallback = innerRect =&gt;
                          {
                              EditorGUI.LabelField(innerRect, "Inner List");
                          },
  
                          drawElementCallback = (innerRect, innerIndex, innerA, innerH) =&gt;
                          {
                              // Get element of inner list
                              var innerElement = InnerList.GetArrayElementAtIndex(innerIndex);
  
                              var name = innerElement.FindPropertyRelative("Name");
  
                              EditorGUI.PropertyField(innerRect, name);
                          }
                      };
  
                      var height = (InnerList.arraySize + 3) * EditorGUIUtility.singleLineHeight;
                      innerReorderableList.DoList(new Rect(rect.x, rect.y, rect.width, height));
                  },
  
                  elementHeightCallback = index =&gt;
                  {
                      var element = SomeClasses.GetArrayElementAtIndex(index);
  
                      var innerList = element.FindPropertyRelative("InnerList");
  
                      return (innerList.arraySize + 4) * EditorGUIUtility.singleLineHeight;
                  }
              };
          }
  
          public override void OnInspectorGUI()
          {
              serializedObject.Update();
  
              list.DoLayoutList();
  
              serializedObject.ApplyModifiedProperties();
          }
      }
  }
  </code></pre>
  
  <hr>
  
  <p><strong>Update</strong></p>
  
  <p>The same apprantly also doesn't work if I have a <code>ReorderableList</code> within a <code>CustomPropertyDrawer</code>.</p>
  
  <p><strong>But</strong> to my suprise if I have a <a href="https://docs.unity3d.com/ScriptReference/Events.UnityEvent.html" rel="noreferrer"><code>UnityEvent</code></a> both works: Having it inside a <code>CustomPropertyDrawer</code> or within a <code>ReorderableList</code>. I can add and remove items as expected.</p>
  
  <p>As you can see here I added a <code>UnityEvent</code> field by adding</p>
  
  <pre><code>[Serializable]
  public class SomeClass
  {
      public string Name;
      public List&lt;SomeClass&gt; InnerList;
  }
  </code></pre>
  
  <p>and using</p>
  
  <pre><code>//...
  innerReorderableList.DoList(new Rect(rect.x, rect.y, rect.width, height));
  
  var InnerEvent = element.FindPropertyRelative("InnerEvent");
  var pers = InnerEvent.FindPropertyRelative("m_PersistentCalls.m_Calls");
  var evHeight = (Mathf.Max(1, pers.arraySize) * 2 + 3) * EditorGUIUtility.singleLineHeight;
  EditorGUI.PropertyField(new Rect(rect.x, rect.y, rect.width, evHeight), InnerEvent);
  </code></pre>
  
  <p>and adjusting the <code>elementHeightCallback</code> to</p>
  
  <pre><code>elementHeightCallback = index =&gt;
  {
      var element = SomeClasses.GetArrayElementAtIndex(index);
  
      var innerList = element.FindPropertyRelative("InnerList");
      var InnerEvent = element.FindPropertyRelative("InnerEvent");
      var pers = InnerEvent.FindPropertyRelative("m_PersistentCalls.m_Calls");
  
      return (Mathf.Max(1, innerList.arraySize) + 4 + Mathf.Max(1, pers.arraySize) * 2 + 4) * EditorGUIUtility.singleLineHeight;
  }
  </code></pre>
  
  <p>I can fully interact with it as expected and also select and remove entries.</p>
  
  <p><a href="https://i.stack.imgur.com/40s4L.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/40s4L.gif" alt="enter image description here"></a></p>
  
  <p><strong>So what are they doing different?</strong></p>