Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Editor/ReorderableDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public override float GetPropertyHeight(SerializedProperty property, GUIContent
ReorderableList list = GetList(property, attribute as ReorderableAttribute, ARRAY_PROPERTY_NAME);

return list != null ? list.GetHeight() : EditorGUIUtility.singleLineHeight;
}
}

public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {

Expand Down Expand Up @@ -85,7 +85,7 @@ public static ReorderableList GetList(SerializedProperty property, ReorderableAt

ReorderableList.ElementDisplayType displayType = attrib.singleLine ? ReorderableList.ElementDisplayType.SingleLine : ReorderableList.ElementDisplayType.Auto;

list = new ReorderableList(array, attrib.add, attrib.remove, attrib.draggable, displayType, attrib.elementNameProperty, attrib.elementNameOverride, icon);
list = new ReorderableList(array, attrib.add, attrib.remove, attrib.draggable, displayType, attrib.elementNameProperty, attrib.elementNameOverride, icon, attrib.expanded);
list.paginate = attrib.paginate;
list.pageSize = attrib.pageSize;
list.sortable = attrib.sortable;
Expand Down
9 changes: 8 additions & 1 deletion Editor/ReorderableList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public enum ElementDisplayType {
public bool draggable;
public bool sortable;
public bool expandable;
public bool isExpandedDefault;
public bool multipleSelection;
public GUIContent label;
public float headerHeight;
Expand Down Expand Up @@ -138,7 +139,7 @@ public ReorderableList(SerializedProperty list, bool canAdd, bool canRemove, boo
: this(list, canAdd, canRemove, draggable, elementDisplayType, elementNameProperty, null, elementIcon) {
}

public ReorderableList(SerializedProperty list, bool canAdd, bool canRemove, bool draggable, ElementDisplayType elementDisplayType, string elementNameProperty, string elementNameOverride, Texture elementIcon) {
public ReorderableList(SerializedProperty list, bool canAdd, bool canRemove, bool draggable, ElementDisplayType elementDisplayType, string elementNameProperty, string elementNameOverride, Texture elementIcon, bool isExpandedDefault = false) {

if (list == null) {

Expand Down Expand Up @@ -169,9 +170,15 @@ public ReorderableList(SerializedProperty list, bool canAdd, bool canRemove, boo
this.elementNameProperty = elementNameProperty;
this.elementNameOverride = elementNameOverride;
this.elementIcon = elementIcon;
this.isExpandedDefault = isExpandedDefault;

id = GetHashCode();

list.isExpanded = true;
if (!isExpandedDefault){
list.isExpanded = false;
}

label = new GUIContent(list.displayName);
pageInfoContent = new GUIContent();
pageSizeContent = new GUIContent();
Expand Down
3 changes: 2 additions & 1 deletion Runtime/Attributes/ReorderableAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class ReorderableAttribute : PropertyAttribute {
public bool draggable;
public bool singleLine;
public bool paginate;
public bool expanded;
public bool sortable;
public bool labels;
public int pageSize;
Expand All @@ -35,7 +36,7 @@ public ReorderableAttribute(string elementNameProperty, string elementNameOverri
: this(true, true, true, elementNameProperty, elementNameOverride, elementIconPath) {
}

public ReorderableAttribute(bool add, bool remove, bool draggable, string elementNameProperty = null, string elementIconPath = null)
public ReorderableAttribute(bool add, bool remove, bool draggable, string elementNameProperty = null, string elementIconPath = null)
: this(add, remove, draggable, elementNameProperty, null, elementIconPath) {
}

Expand Down