/// <summary> /// Given a path of the form "managedReferences[refid].field" this finds the first field /// that references that reference id and returns a serialized property based on that path. /// For example if an object "Foo" with id 1 is referenced by multiple fields "a", "b" and /// "c.nested" on a MonoBehaviour (declared in that order), then calling this method with /// "managedReferences[1].x" would return the SerializedProperty with property path "a.x". /// </summary> internal SerializedProperty FindFirstPropertyFromManagedReferencePath(string propertyPath) { SerializedProperty i = GetIterator_Internal(); // This is so the garbage collector won't clean up SerializedObject behind the scenes, // when we are still iterating properties i.m_SerializedObject = this; if (i.FindFirstPropertyFromManagedReferencePathInternal(propertyPath)) { return(i); } else { return(null); } }