private static T GetPropertyAttribute <T>(SerializedProperty property) where T : Attribute { T[] propertyAttributes = ReorderableArrayEditor.GetPropertyAttributes <T>(property); if (propertyAttributes != null && propertyAttributes.Length > 0) { return(propertyAttributes[0]); } return((T)((object)null)); }
public static bool HasReorderableAttribute(SerializedProperty property) { PropertyAttribute[] propertyAttributes = ReorderableArrayEditor.GetPropertyAttributes <PropertyAttribute>(property); if (propertyAttributes != null) { PropertyAttribute[] array = propertyAttributes; for (int i = 0; i < array.Length; i++) { PropertyAttribute propertyAttribute = array[i]; if (propertyAttribute.GetType().Name == "ReorderableAttribute") { return(true); } } } return(false); }
public void DrawReorderableArray(SerializedProperty property) { HeaderAttribute propertyAttribute = ReorderableArrayEditor.GetPropertyAttribute <HeaderAttribute>(property); if (propertyAttribute != null) { EditorGUILayout.Space(); EditorGUILayout.LabelField(propertyAttribute.header, EditorStyles.boldLabel, new GUILayoutOption[0]); } ReorderableArrayEditor.ReorderableListWrapper reorderableListWrapper = this.GetReorderableListWrapper(property); if (reorderableListWrapper.isExpanded) { reorderableListWrapper.list.DoLayoutList(); } else { property.isExpanded = (EditorGUILayout.Foldout(property.isExpanded, new GUIContent(string.Format("{0} [{1}]", property.displayName, property.arraySize), property.tooltip))); } }
public void DrawProperty(SerializedProperty property) { if (property.isArray && property.propertyType != SerializedPropertyType.String && ReorderableArrayEditor.HasReorderableAttribute(property)) { this.DrawReorderableArray(property); } else { EditorGUILayout.PropertyField(property, property.isExpanded, new GUILayoutOption[0]); } }