/// <summary> /// Registers the array property and its size property. /// </summary> /// <param name="arrayProperty">Array property.</param> /// <param name="getter">Getter.</param> /// <param name="setter">Setter.</param> /// <param name="propertyType">Property type.</param> private static void RegisterArrayProperty( SerializedProperty arrayProperty, System.Func<object, object> getter, System.Action<object, object> setter, System.Type propertyType ) { HashableSerializedProperty hashableArrayProperty = new HashableSerializedProperty(arrayProperty.propertyPath, arrayProperty.serializedObject.targetObject); HashableSerializedProperty hashableArraySizeProperty = new HashableSerializedProperty( arrayProperty.propertyPath + ".Array.size", arrayProperty.serializedObject.targetObject ); RegisterPropertyIfNeeded(hashableArrayProperty, hashableArrayProperty, getter, setter, propertyType); RegisterPropertyIfNeeded(hashableArraySizeProperty, hashableArrayProperty, getter, setter, propertyType); FieldInfo field; arrayProperty.GetProvider(out field); s_ValueCache[hashableArrayProperty] = field.FieldType.IsArray ? System.Array.CreateInstance(field.FieldType.GetElementType(), 0) : System.Activator.CreateInstance(field.FieldType); s_ValueCache[hashableArraySizeProperty] = 0; }