[Released] Session Restore


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 :slight_smile: 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
  • Highly optimised, you won’t even know it’s there
  • Unity 5.6 - 2022.x supported
  • All Unity platforms supported
  • Full source code included

You can find it here on the Unity Asset Store.

Thanks,

2 Likes

Please post reviews on the Asset Store if you do try it out :slight_smile:

I thought about this the other day. Then this appeared.

Haven’t tried it yet but I appreciate the creation.

1 Like

BUMP Please comment here or post reviews on the Asset Store if you do try it out :slight_smile:

Any feedback? Anyone tried it? :slight_smile:

Hi Everyone,

Version 1.3 has just been released. Changes are:

  • Fixed issue where “Maximise on Play” would spawn another Hierarchy window
  • Fixed Unity 5.0.x script compile errors
  • Improved detection method for Hierarchy window

Drop us a review/message if you like this script :slight_smile:

Thanks,

Hi Everyone,

Version 1.4 has just been released. Changes are:

  • Added support for Unity 2018.3.x as it changed some internal classes
  • Added support for expanding collapsed scenes
  • Improved detection of changed hierarchy window
  • Refactored reflection caching code
  • Fixed a deprecated method warning for hierarchyChanged

Drop us a review/message if you like this script :slight_smile:

Thanks,

1 Like

I like it!

I have one request, when I press play it also loses my selected hierarchy object ,can you also make it to keep this selected ?

Mac with 2018.3.0f2

Edit: Its working after a restart of unity

Thanks for the feedback :wink:
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,

1 Like

Hi Everyone,

Version 1.4.1 has just been released. Changes are:

  • Added support for the new Prefab Mode editor in 2018.3.x, so that the plugin doesn’t operate while the hierarchy window is in this mode

Drop us a review/message if you like this script :slight_smile:

Thanks,

1 Like

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.

Yeah it probably doesn’t yet support some of these newer Unity versions…

Would you have time to make it work with 2019.4 ?

Thanks

Yeah…it’s on my mental list of things to do :slight_smile: Just no time right now…Hopefully soon!

1 Like

Hi Everyone,

Hierarchy Restore version 1.5.0 has just been released!

You can find the updated version on the Asset Store
Changes in this version include:

  • Added support for Unity 2019 and 2020
  • Added new feature to restore the scene view window
  • Better detection of changes in hierarchy collapsed state
  • Added options to Unity’s Preferences window
  • Minimum supported version is now Unity 5.6

Thanks to everyone that reported bugs that were fixed in this release :slight_smile:

1 Like

Thanks for the update! really welcome

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.

1 Like

Thanks tavovallejo for these changes! We will take a look and see whether we can get them into the next update.

1 Like

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.

1 Like