void OnEnable() { if (view == null) { view = (EntityBehaviour)target; } // reorderableComponents = new ReorderableList(serializedObject, serializedObject.FindProperty("ComponentTypes"), true, true, true, true); reorderableComponents = new ReorderableList(serializedObject, serializedObject.FindProperty("Components"), true, true, true, true); reorderableComponents.drawHeaderCallback = (Rect rect) => { EditorGUI.LabelField(rect, "Components", EditorStyles.boldLabel); }; reorderableComponents.drawElementCallback = (rect, index, isActive, isFocused) => { // var component = (object)Activator.CreateInstance(view.ComponentTypes[index].GetTypeWithAssembly()); // JsonUtility.FromJsonOverwrite(view.ComponentData[index], component); // OnDrawElement(rect, component, index, componentHeights); // view.ComponentData[index] = JsonUtility.ToJson(component); // //OnDrawElement(reorderableComponents, view.Components[index].GetType().ToString(), rect, index, isActive, isFocused, componentHeights); var label = view.Components[index] != null ? view.Components[index].GetType().ToString() : "None"; OnDrawElement(reorderableComponents, label, rect, index, isActive, isFocused, componentHeights, false); }; reorderableComponents.elementHeightCallback = (index) => { return(componentHeights[index]); // return OnElementHeight(reorderableComponents, index); }; reorderableComponents.onAddDropdownCallback = (Rect rect, ReorderableList list) => { // OnAddDropdown(rect, list, AddComponent, componentBaseTypes.ToArray()); view.Components = view.GetComponents <Component> ().Where(c => c.GetType() != typeof(Transform) && c.GetType() != typeof(EntityBehaviour)).ToArray(); EditorUtility.SetDirty(target); }; reorderableComponents.onRemoveCallback = (list) => { // RemoveComponent(list); view.Components = null; }; reorderableBlueprints = new ReorderableList(serializedObject, serializedObject.FindProperty("Blueprints"), true, true, true, true); reorderableBlueprints.drawHeaderCallback = (Rect rect) => { EditorGUI.LabelField(rect, "Blueprints", EditorStyles.boldLabel); }; reorderableBlueprints.drawElementCallback = (rect, index, isActive, isFocused) => { var label = view.Blueprints[index] != null ? view.Blueprints[index].GetType().ToString() : "None"; OnDrawElement(reorderableBlueprints, label, rect, index, isActive, isFocused, blueprintHeights); }; reorderableBlueprints.elementHeightCallback = (index) => { return(blueprintHeights[index]); // return OnElementHeight(reorderableBlueprints, index); }; reorderableBlueprints.onAddDropdownCallback = (Rect rect, ReorderableList list) => { OnAddDropdown(list, "Blueprints"); }; reorderableBlueprints.onRemoveCallback = (list) => { RemoveBlueprint(list); }; }