private void UpdateElementNames(SerializedProperty listProperty, SerializedProperty nameOverride) { ReorderableList list = ReorderableDrawer.GetList(listProperty, ReorderableDrawer.ARRAY_PROPERTY_NAME); if (list != null) { list.elementNameOverride = nameOverride.stringValue; } }
private float GetHeightOld(SerializedProperty parent, SerializedProperty property) { if (property.isArray && property.propertyType != SerializedPropertyType.String) { var list = ReorderableDrawer.GetList(parent, new ReorderableAttribute { labels = false }, property.name.GetHashCode(), property.name); if (!listWithCallback.ContainsKey(list)) { list.drawElementCallback += (r, e, l, s, f) => List_drawElementCallback(r, property, e, l, s, f); list.getElementHeightCallback += (e) => List_getElementHeightCallback(property, e); listWithCallback.Add(list, true); } return(list.GetHeight() + ELEMENT_HEIGHT_OFFSET * 2); } else if (property.hasVisibleChildren) { var height = ELEMENT_HEIGHT_OFFSET * 2; if (property.isExpanded) { height += EditorGUI.GetPropertyHeight(property, GUIContent.none, true); if (HasCustomPropertyDrawer(property) && level == 0) { height += 20; } } else { height += 20; } return(height); } else { var height = 0f; if (level == 0) { height += 20 + ELEMENT_HEIGHT_OFFSET * 2; } if (property.isExpanded) { height += EditorGUI.GetPropertyHeight(property, true); } return(height); } }
private float GetListPropertyHeight(SerializedProperty parent, SerializedProperty property) { var list = ReorderableDrawer.GetList(parent, new ReorderableAttribute { labels = false }, property.name.GetHashCode(), property.name); if (list == null) { Debug.Log(parent.propertyPath + " " + property.propertyPath); return(0f); } list.elementLabels = false; if (!listWithCallback.ContainsKey(list)) { var originalP = property.Copy(); list.drawElementCallback += (r, e, l, s, f) => List_drawElementCallback(r, originalP, e, l, s, f); list.getElementHeightCallback += (e) => List_getElementHeightCallback(originalP, e); listWithCallback.Add(list, true); } return(list.GetHeight()); }
private void DoListProperty(Rect rect, SerializedProperty parent, SerializedProperty property) { var list = ReorderableDrawer.GetList(parent, new ReorderableAttribute { labels = false }, property.name.GetHashCode(), property.name); if (list == null) { Debug.Log(parent.propertyPath + " " + property.propertyPath); return; } list.elementLabels = false; if (!listWithCallback.ContainsKey(list)) { var originalP = property.Copy(); list.drawElementCallback += (r, e, l, s, f) => List_drawElementCallback(r, property, e, l, s, f); list.getElementHeightCallback += (e) => List_getElementHeightCallback(property, e); listWithCallback.Add(list, true); } list.DoList(rect, new GUIContent(property.displayName)); }