Session Restore
Latest version: 2.0.1 released 28 June 2022
Hi Everyone,
We’ve just released a must-have productivity Unity extension called Session Restore. This is an editor extension for anyone working on multiple Unity scenes/projects and knows how distracting context switching is and wants to improve the workflow of their team.
The first feature is that it restores your Hierarchy window state in Unity. This means when you start Unity or switch between scenes, it will set the Hierarchy window to the state when you worked on it last (same GameObjects expanded, same GameObjects selected).
Without this script Unity always opens up the Hierarchy view collapsed and with nothing selected, which personally I find annoying It also resets the Hierarchy when you make a build or play the scene which compounds the issue.
This script also restores the scene view and prefab windows so you can continue where you left off when switching between multiple Unity projects.
Features:
Restores hierarchy window
Restores selection state
Restores scene view camera
Improves workflow and sanity
No setup, just import the package and it starts working immediately
Thanks for the feedback
Yes, there are a few edge cases where it doesn’t save the selection immediately…it should be fine in 95% of cases though. Thanks,
This is just what I need, but I can’t seem to get it to work. I downloaded and imported it into my project. It shows in the Project window, but not in the Hierarchy window. If I build, or if I close Unity and reopen it, my hierarchy gets collapsed. The manual says it’s supposed to automatically work. Did I miss a step? (I’m fairly newbie.) I’m using 2019.2.4f1. Thank you.
hello, I made some changes (fixes for me) that you could implement in a more elegant way.
#if UNITY_5_3 || UNITY_5_4_OR_NEWER
#define RH_UNITY_FEATURE_SCENEMANAGMENT2
#endif
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
//-----------------------------------------------------------------------------
// Copyright 2017-2020 RenderHeads Ltd. All rights reserved.
//-----------------------------------------------------------------------------
namespace RenderHeads.Framework.Editor
{
public partial class HierarchyNode : MonoBehaviour
{
static bool wasPayingFlag;//ugly but works
private void Start()
{
///second change
if(wasPayingFlag)//if i was playing the game in the editor
{
wasPayingFlag = false;//reset the flag
return;//The reason: I want the same behavior of unity when playing and then stoping.
//so instead of restoring the selection and hierarchy, when exiting play mode.
//I just use the default behavior.
}
///
if(!HierarchyRestore.IsEnabled) return;
RestoreSelection();
}
private void UpdateSceneGUID()
{
#if RH_UNITY_FEATURE_SCENEMANAGMENT2
///dint work for me
///the whole hierarchy is being reset, every time I hit play
//_sceneGUID = GetSceneGUID(EditorSceneManager.GetActiveScene().path);
///first change
_sceneGUID = gameObject.scene.path;//I have a script that dynamically changes the active scene, every time I hit play or stop.
//so I prefer to get the scene from the object rather than the scene manager
///
#else
_sceneGUID = GetSceneGUID(EditorApplication.currentScene);
#endif
}
private void Update()//added just to set the flag
{
if(Application.isPlaying)
wasPayingFlag = true;
}
}
}
#endif
Thank you for this asset, for me, unity crashes all the time, so this is a time/sanity saviour.
So i made anther change, I set the Script Execution Order of HierarchyNode to -15000, to get rid of “[HierarchyRestore] Can’t find node with path:” . Warnings are logged if you changed the name of the objects.