diff --git a/Packages/com.deltation.di-framework/Assets/DELTation/DIFramework/Editor/ListDependencyContainerCustomEditor.cs b/Packages/com.deltation.di-framework/Assets/DELTation/DIFramework/Editor/ListDependencyContainerCustomEditor.cs index 4890d52a..224c7c1c 100644 --- a/Packages/com.deltation.di-framework/Assets/DELTation/DIFramework/Editor/ListDependencyContainerCustomEditor.cs +++ b/Packages/com.deltation.di-framework/Assets/DELTation/DIFramework/Editor/ListDependencyContainerCustomEditor.cs @@ -69,7 +69,11 @@ private void DrawList(SerializedObject container, SerializedProperty list) if (index == list.arraySize - 1) EditorGUI.EndDisabledGroup(); - if (MiniButton("+")) list.InsertArrayElementAtIndex(index); + if (MiniButton("+")) + { + list.InsertArrayElementAtIndex(index); + list.GetArrayElementAtIndex(index + 1).objectReferenceValue = null; + } if (MiniButton("-")) DeleteArrayElementAtIndex(list, index); @@ -85,12 +89,10 @@ private void DrawList(SerializedObject container, SerializedProperty list) if (selectedIndex != 0) { var listDependencyContainer = (ListDependencyContainer) container.targetObject; - listDependencyContainer.Add(components[selectedIndex - 1]); + list.GetArrayElementAtIndex(index).objectReferenceValue = components[selectedIndex - 1]; + container.ApplyModifiedProperties(); container.Update(); EditorUtility.SetDirty(listDependencyContainer); - - list.DeleteArrayElementAtIndex(index); - list.DeleteArrayElementAtIndex(index); } } diff --git a/Packages/com.deltation.di-framework/package.json b/Packages/com.deltation.di-framework/package.json index 296f5bdf..a35473c1 100644 --- a/Packages/com.deltation.di-framework/package.json +++ b/Packages/com.deltation.di-framework/package.json @@ -1,6 +1,6 @@ { "name": "com.deltation.di-framework", - "version": "2.6.1", + "version": "2.6.2", "displayName": "DI Framework", "description": "A simple Unity DI/IoC framework to inject dependencies into your components.", "unity": "2020.3",