We are currently trying to implement an editor tool that helps us switching scenes when entering playmode and then return to the previous scene you had open before you entered playmode. For that, we wish to recreate the collapse state of the Hiearchy Editor Window. We try implement this using reflection and using the functionality found in the non-documented: Code (CSharp): int UnityEditor.IMGUI.Controls.TreeViewDataSource.GetExpandedIDs() The primary issue we are facing is that it appears the GetExpandedIDs() increments when entering/leaving playmode. This can however be resolved by closing and opening the Hiearchy EditorWindow. The amount that is incremented between entering/exiting playmode seems to correlate with how many additive scenes that are loaded in the scene. E.g. if there is only 1 scene, GetExpandedIds() keeps incrementing with 1. If there are 2 scenes, it seems like it increments with 2. Anyone have an idea why this keeps getting incremented?