ReorderableListProperty ObtainList(SerializedProperty i_property, string i_id) { string key = i_id + "///" + i_property.name; if (m_propertyLists.ContainsKey(key)) { return m_propertyLists[key]; } else { ReorderableListProperty ret = new ReorderableListProperty(i_property); m_propertyLists.Add(key, ret); return ret; } }
void DisplayArray(SerializedProperty i_property, string i_id, bool i_expanded) { if (!i_expanded) { string content = ""; for (int i = 0; i < i_property.arraySize; ++i) { SerializedProperty property = i_property.GetArrayElementAtIndex(i); if (i > 0) { content += ", "; } if (property.type == "string") { content += property.stringValue; } else if (property.type == "int") { content += property.intValue.ToString(); } else if (property.type == "PPtr<$Sprite>") { content += ((Sprite)property.objectReferenceValue).name; } else { Debug.LogWarning("Cannot handle property of type " + property.type + " in array. Ask a programmer to add it (it is easy)"); } } content += ""; EditorGUILayout.LabelField(content, GUILayout.Width(k_columnWidth)); } else { EditorGUILayout.BeginVertical(GUILayout.Width(k_columnWidth)); ReorderableListProperty listData = ObtainList(i_property, i_id); listData.List.DoLayoutList(); EditorGUILayout.EndVertical(); } }