2 using System.Collections.Generic;
11 public static class SerializedPropertyExtensions
18 public static IEnumerable<SerializedProperty> GetChildren(
this SerializedProperty serializedProperty)
20 SerializedProperty currentProperty = serializedProperty.Copy();
21 SerializedProperty nextSiblingProperty = serializedProperty.Copy();
23 nextSiblingProperty.Next(
false);
26 if (currentProperty.Next(
true))
30 if (SerializedProperty.EqualContents(currentProperty, nextSiblingProperty))
33 yield
return currentProperty;
35 while (currentProperty.Next(
false));
44 public static IEnumerable<SerializedProperty> GetVisibleChildren(
this SerializedProperty serializedProperty)
46 SerializedProperty currentProperty = serializedProperty.Copy();
47 SerializedProperty nextSiblingProperty = serializedProperty.Copy();
49 nextSiblingProperty.NextVisible(
false);
52 if (currentProperty.NextVisible(
true))
56 if (SerializedProperty.EqualContents(currentProperty, nextSiblingProperty))
59 yield
return currentProperty;
61 while (currentProperty.NextVisible(
false));