improving stability of template overriders in prefabs

This commit is contained in:
Mikhail 2024-05-19 23:02:00 +08:00
parent 990f3adda6
commit 0823707ac8

View File

@ -71,10 +71,9 @@ namespace DCFApixels.DragonECS.Unity.Editors
return;
}
}
componentsProp.InsertArrayElementAtIndex(0);
componentsProp.GetArrayElementAtIndex(0).managedReferenceValue = ((IComponentTemplate)obj).Clone();
int index = componentsProp.arraySize;
componentsProp.InsertArrayElementAtIndex(index);
componentsProp.GetArrayElementAtIndex(index).managedReferenceValue = ((IComponentTemplate)obj).Clone();
serializedObject.ApplyModifiedProperties();
EditorUtility.SetDirty(this.target);
@ -104,10 +103,11 @@ namespace DCFApixels.DragonECS.Unity.Editors
GUILayout.BeginVertical(UnityEditorUtility.GetStyle(Color.black, 0.2f));
DrawTop(target);
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);
}
GUILayout.EndVertical();
}
private void DrawTop(ITemplateInternal target)