Hello, i’m using Unity 2019.3.0b9 (but I’ve had similar problem on Unity 2017.4 as well). I have a problem with hierarchy order. I’ve managed to simplify the problem to a simple scene. My hierarchy looks like this:

I want it to preserve the order when I hit play. But somehow 3_Prefab instance goes before 2nd element and in play mode my hierarchy looks like this:

All Gameobjects in the scene have only RectTransform component. There are no scripts.
I’m using prefabs for UI elements and the hierarchy order has to be preserved.
When I looked in the scene file I see PrefabInstance section but strangely the m_RootOrder value is 1.

When I change it manually in the .unity file to 2, everything works like a charm. IMO somehow the scene does not save the root order of the prefab instance in the .unity file.
Am I missing something? Am I doing something wrong?
I want to add that I realized that in the PrefabInstance section there is a lot of unused overrides from previous “forms” of the prefab, which is kinda explaining why my scene files are so large… Maybe these unused overrides are generating the problem?
That prefab modification of m_RootOrder on target fileID 0 can be also removed and everything is working as expected. Is there a better solution than manually editing scene files? I have a big project and lots of prefabs in scenes.
Revert All changes on prefab instance also work, but this is unacceptable solution because I would need to recreate all prefabs basically from scratch again.
Can I just safely remove all “- target: {fileID: 0}” modifications from my scene files? What does “fileID: 0” mean? How are prefab modifications sorted in scene file?
I’m experimenting with this whole day and it seems to me that it takes the first m_RootOrder modified property regardless of target fileID? This behaviour is obviously very bad. I have more than 1 m_RootOrder modification from my prefab. Is this allowed with the new prefab system? Am I allowed to modified prefab’s children root order? If not then it is reasonable that Unity reads the first rootOrder modification and assumes that it has to be done on the prefab root transform. I would have to reorganize my prefabs to meet new requirements.
Is that correct?
I’m attaching my sample project. Try to move prefab to the 3rd place, then save the scene, then hit play.
Thanks for any help!

5148362–509804–HierarchyOrderTest.zip (21.1 KB)
