Hierarchy objects move around randomly

I don’t know what triggers this, but sometimes in the editor, the objects in the hierarchy start changing positions. I generally notice this after running the game in the editor. I have a simple scene where game objects are below blank objects acting as headers named “Controllers”, “Background”, etc. Suddenly all my controllers are above my controller heading as well as other shenanigans. Any idea how to fix this? (Unity 2019.2.10f)

This usually only happens when you play the Scene, right after you started playing, and while the Scene is running (remember that you can still edit your Scene while playing, and all changes will be lost when you stop playing the scnee.

Are you also observing this behaviour while NOT playing?

I think it’s only after playing the scene, then returning to editor mode, the object positions are jumbled and stay that way. It only happens a fraction of the time though.

Does any of your code make any changes to transform.parent, call transform.SetParent(…) or do anything similar?

Afaik unity recently introduced ordering in hierarchy window, the button in inspector is very small, check it out maybe you accidentally pushing it?

Scroll down for Alphanumeric Sorting chapter

Nope. I have confirmed that the hierarchy object positions only change after running play in the editor. Hmmm…