Merge branch 'dev'

This commit is contained in:
Mikhail 2024-05-19 23:02:38 +08:00
commit e8653beb9d

View File

@ -71,10 +71,9 @@ namespace DCFApixels.DragonECS.Unity.Editors
return; return;
} }
} }
int index = componentsProp.arraySize;
componentsProp.InsertArrayElementAtIndex(0); componentsProp.InsertArrayElementAtIndex(index);
componentsProp.GetArrayElementAtIndex(index).managedReferenceValue = ((IComponentTemplate)obj).Clone();
componentsProp.GetArrayElementAtIndex(0).managedReferenceValue = ((IComponentTemplate)obj).Clone();
serializedObject.ApplyModifiedProperties(); serializedObject.ApplyModifiedProperties();
EditorUtility.SetDirty(this.target); EditorUtility.SetDirty(this.target);
@ -104,10 +103,11 @@ namespace DCFApixels.DragonECS.Unity.Editors
GUILayout.BeginVertical(UnityEditorUtility.GetStyle(Color.black, 0.2f)); GUILayout.BeginVertical(UnityEditorUtility.GetStyle(Color.black, 0.2f));
DrawTop(target); DrawTop(target);
GUILayout.Label("", GUILayout.Height(0), GUILayout.ExpandWidth(true)); GUILayout.Label("", GUILayout.Height(0), GUILayout.ExpandWidth(true));
for (int i = 0; i < componentsProp.arraySize; i++) for (int i = componentsProp.arraySize - 1; i >= 0; i--)
{ {
DrawComponentData(componentsProp.GetArrayElementAtIndex(i), componentsProp.arraySize, i); DrawComponentData(componentsProp.GetArrayElementAtIndex(i), componentsProp.arraySize, i);
} }
GUILayout.EndVertical(); GUILayout.EndVertical();
} }
private void DrawTop(ITemplateInternal target) private void DrawTop(ITemplateInternal target)