Runtime Inspector and Hierarchy [Open Source]

Hello there,

While working on a project that needed some sort of in-game editor for a while, I have developed a runtime Inspector and Hierarchy solution that works similar to Unity’s own Hierarchy and Inspector views.

Asset Store: Runtime Inspector & Hierarchy | GUI Tools | Unity Asset Store
Also available at: GitHub - yasirkula/UnityRuntimeInspector: Runtime Inspector and Hierarchy solution for Unity for debugging and runtime editing purposes
Discord: yasirkula Unity Assets
GitHub Sponsors :coffee:

FEATURES

  • The hierarchy costs 1 SetPass call and ~4 batches (assuming that Sprite Packing is enabled in Editor Settings)
  • The inspector costs 1 SetPass call and ~10 batches (assuming that Sprite Packing is enabled in Editor Settings)
  • Both panels are heavily optimized in terms of GC in order not to generate any unnecessary garbage. By default, both the inspector and the hierarchy are refreshed every frame to reflect any changes to their user interface immediately. This generates some garbage especially for the inspector as, most of the time, the inspected object has variables of value types. These variables are boxed when accessed via reflection and this boxing creates some unavoidable garbage. However, this process can be greatly optimized by increasing the Refresh Interval of the inspector and/or the hierarchy
  • Includes a built-in color picker and a reference picker:

  • Visual appearance of the inspector and the hierarchy can be tweaked by changing their Skin. There are two premade skins included in the Skins directory: LightSkin and DarkSkin. You can create your own skins using the Assets-Create-yasirkula-RuntimeInspector-UI Skin context menu

You can visit the repo for more info.

Enjoy!

10 Likes

Very nice !
Thanks for sharing this

This is funtastic! I tried it and works perfect! Thank you very much! :wink:

Thanks :smile:

And we are live on Asset Store!

Hi,
Great asset!

Although I have a problem: I use the default hierarchy prefab, but the hierarchy is empty when running in the player (android, win). In the editor it works fine. Can you tell me what to look for?
Using unity 2017.2.0f3

Edit:

  1. tested with 2017.3.1f1 and it works
  2. in 2017.3.0f1 added Mask instead of RectMask2D and it works
    Maybe this helps. Have a nice day :slight_smile:

Thank you for all the information. I’ll definitely look into it.

While reproducing the issue on Unity 2017.2.0f3, I also noticed that some of my sprites were looking ugly in that version of Unity. In fact, it was the case for some of my other plugins, as well.

Anyways, after adding these two lines to the Awake function of SkinnedWindow.cs, the problem disappeared on Unity 2017.2.0f3.

gameObject.SetActive( false );
gameObject.SetActive( true );

It also works fine on Unity 2017.3.0p2 but I don’t have Unity 2017.3.0f1 installed so I couldn’t test it on that version.

I’ve pushed an update to the GitHub repository and will push an update to the Asset Store version, as well. The update includes a bugfix for those terrible sprites, too.

Great asset. The only issue I noticed was it can sometimes be hard to click on the little arrows, but that’s a minor problem and not really an “issue”.

This asset helped us solve a problem in one of our apps after we swapped some stuff around.

1 Like

Hi there,
I love this asset, it’s awesome and useful and I’m currently using it in a customer’s project. However, I do have two severe issues I can’t solve myself, concerning the Runtime Hierarchy:

  1. I need to use the slider like a normal slider, as you see it everywhere. It seems to work like something for a touch input, but that’s not usable for me.
  2. I can’t get a horizontal slider working. This seems to be an issue due to the massive use of content size fitters and layout groups, and I tried to get into this, but it’s too complex for me to dig in (not the fitters themselves, but the use of it in the runtime hierarchy).

Could you please provide some help for that? I would appreciate it a lot.
Thanks in advance!

There you go.

3477214–276409–RuntimeInspector.unitypackage (227 KB)

Just had a play with your asset and its very good, one feature I would like is to be able to drag and drop GameObjects in the Hierarchy to parent them together or to unparent them, like you can with the Editor Hierarchy.

Could this be added relatively easily?

Attaching the following script to RuntimeHierarch, HierarchyItemRoot and HierarchyItemTransform prefabs should do the trick:

using UnityEngine;
using RuntimeInspectorNamespace;
using UnityEngine.EventSystems;

public class HierarchyOnDropParent : MonoBehaviour, IDropHandler
{
    private HierarchyItem target;

    private void Awake()
    {
        target = GetComponent<HierarchyItem>();
    }

    public void OnDrop( PointerEventData eventData )
    {
        Transform droppedTransform = RuntimeInspectorUtils.GetAssignableObjectFromDraggedReferenceItem( eventData, typeof( Transform ) ) as Transform;
        if( droppedTransform == null )
            return;

        Transform newParent = ( target as HierarchyItemTransform ) != null ? ( (HierarchyItemTransform) target ).BoundTransform : null;
        if( droppedTransform.parent == newParent )
            return;

        if( newParent != null )
        {
            // Avoid setting child object as parent of the parent object
            Transform curr = newParent;
            while( curr.parent != null && curr.parent != droppedTransform )
                curr = curr.parent;

            if( curr.parent == droppedTransform )
                curr.SetParent( droppedTransform.parent, false );
        }
      
        droppedTransform.SetParent( newParent, false );

        RuntimeHierarchy hierarchy = GetComponentInParent<RuntimeHierarchy>();
        if( hierarchy != null )
        {
            hierarchy.Refresh();
            hierarchy.Deselect();
            hierarchy.Select( droppedTransform );
        }
    }
}
1 Like

Wow! That was quick, I will try now! :slight_smile:

Just tried that and I can’t drag and drop anything in the runtime Hierarchy? any ideas?

Scratch that! Its does work, its just you have to hold the mouse down for a bit, as per setting Create Dragged Reference On Hold, and Dragged Reference Hold Time. Thank you!!!

Only missing feature to match Editor Hierarchy is that when you drag over a parent object it would be nice if it expanded the sub objects so you can drop the object onto a child.

You are welcome! In case you didn’t know, you can also drop a “Dragged Reference” to Object slots in RuntimeInspector (if they are of compatible types).

P.S. I’ve decided to add this feature to the plugin in the next update. Thanks for the idea!

1 Like

I didn’t know that! That’s perfect!!!

It’s also very kind that your making this available for FREE, I am very grateful to you!

1 Like

Dear Sir, you are awesome!
Thank you so very much for that, highly appreciated!

2 Likes

This is amazing! It makes so easy testing different values for our own games, making changes in runtime to see how they behave, without creating new debug canvas (this is too boring and time consuming).

Is there a function to automatically select a specific game object? I would like to use for my vehicle, so it would begin with it selected.