How to reproduce:
1. Open the “GameObjectOrder20213” project
2. Open the “SampleScene”
3. Enter the Play Mode
4. Observe the Game View
Expected result: In both instances, the green-colored square image is positioned on top of the red-colored square image
Actual result: The position of images varies depending on the versions
Reproducible in: 2022.1.0a15, 2022.3.15f1, 2023.2.4f1, 2023.3.0b1
Not reproducible in: 2021.3.33f1, 2022.1.0a14
Reproduced on: Windows 10
Not reproduced on: No other environments tested
Note:
- Between versions 2021.3.33f and 2022.1.0a14, in both the 'SavedInSceneTest' parent GameObject and the 'OuterPrefab' Prefab in Hierarchy, the 'InnerImage' child objects are positioned after the 'OuterImage' and 'Image' objects
- From version 2022.1.0a15 to 2022.1.0b8, the 'InnerImage' child object appears before the 'Image' child object in the 'SavedInSceneTest' parent object
- Starting from version 2022.1.0b9 and in all the latest versions, for both the 'SavedInSceneTest' parent GameObject and the 'OuterPrefab' Prefab, the 'InnerImage' child objects are placed before the 'OuterImage' and 'Image' objects
- The difference between child GameObjects placement might be related to this issue: https://issuetracker.unity3d.com/issues/m-rootorder-values-change-in-the-prefab-when-editorutility-dot-setdirty-is-called-on-it . Specifically to m_RootOrder being removed from later Unity versions.