Renaming Locked Inspector Tabs

Hi, I just wanted to make a suggestion to add the functionality to rename locked inspector tabs.

I just learned about the functionality to lock tabs and it’s great because I used to find it annoying to constantly switch between inspectors trying to find the asset in the “Project” tab or an object in the “Hierarchy”.

I think it would be much better if we can right-click and rename the locked inspector tabs as well.

Current:
5967077--640112--upload_2020-6-11_5-59-47.png

Suggested:
5967077--640121--upload_2020-6-11_6-13-15.png

Hey Jonathan so we’re tackling this exact problem a different way. In 20.2 (check out the alpha to see it and feedback if you like) you can open a ‘focused inspector’ by doing right click > Properties on any game object, component, or asset this gives you effectively a by default locked inspector where the tab is named after the thing you opened. Here’s a gif!

2 Likes

Oh wow, that’s perfect. I guess y’all were one step ahead of me haha.

1 Like

Hi, just adding a bit to the suggestion…
I think it still would be nice if we could rename any kind of tab, for example, opening a “Project” tab, them choosing a folder, locking that tab and being able to rename the tab so i can quickly access that folder when i need to.

2 Likes

+1 for being able to rename project tabs. I like to lock them with the most used folders. It would be great to see the folder names on the tab headers!

3 Likes

This feature not in yet? I need this

I can’t believe that renaming Project tabs isn’t the thing yet. I desperately need this! Unity please?

Unity, we are waiting fort this feature to be added!

I would like to see this feature as well!

Sometimes I have like 5-10 Projects tabs opened (Scripts, Prefabs, Textures, Sounds) and because of lack of renaming possibility I started to group and seperating them using other tabs (e.g. Console, Inspector), which is better than nothing, but rename function would be a blessing!

Plus one, would be terribly useful for me

9759486--1397712--2024-04-09 170557.png

Bunny83 have already done some of the work
https://discussions.unity.com/t/is-it-possible-to-rename-tabs-in-editor/249558

+1 waiting for this!

Yea I also want to be able to rename project tabs the other way for inspector is pretty nice, but I would also prefer if I can just change the name of the inspector (seems more intuitive this way and I might want a different name)

Hi, very nice info :slight_smile:

Will this tab act same as inspector, like activate the custom editors assigned to the object scripts ?

I see some people still waiting for this (I was one too), soo… Here is the script that renames locked Project tabs

// Script that changes the locked Project tab title to their current folder name
using System;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEngine;

public static class ProjectTabTitler
{
    private static bool isInitialized = false;
    private static Type projectBrowserType;
    private static FieldInfo titleContentField;
    private static MethodInfo getActiveFolderMethod;
    private static PropertyInfo isLockedProperty;

    [InitializeOnLoadMethod, ExecuteInEditMode]
    private static void Initialize()
    {
        if (isInitialized)
            return;

        projectBrowserType = Assembly.GetAssembly(typeof(EditorWindow)).GetTypes().First(x => x.Name == "ProjectBrowser");

        titleContentField = projectBrowserType.GetField("m_TitleContent", BindingFlags.Instance | BindingFlags.NonPublic);
        getActiveFolderMethod = projectBrowserType.GetMethod("GetActiveFolderPath", BindingFlags.NonPublic | BindingFlags.Instance);
        isLockedProperty = projectBrowserType.GetProperty("isLocked", BindingFlags.Instance | BindingFlags.NonPublic);

        EditorApplication.update += UpdateProjectTabTitles;

        isInitialized = true;
    }

    private static void UpdateProjectTabTitles()
    {
        var windows = Resources.FindObjectsOfTypeAll(projectBrowserType);
        string title;
        foreach (var window in windows)
        {
            // Revert to default Project tab
            if (!(bool)isLockedProperty.GetValue(window))
            {
                title = "Project";
            }
            // Set custom title
            else
            {
                // Path relative to Project folder
                title = getActiveFolderMethod.Invoke(window, new object[] { }).ToString();

                // Folder name only
                title = title.Split("/").Last();
            }

            GUIContent titleContent = new GUIContent(titleContentField.GetValue(window) as GUIContent);
            titleContent.text = title;

            titleContentField.SetValue(window, titleContent);
        }
    }
}