- Home /
How can I permanently display (`EditorApplication's) current scene name in Editor?
I need a script which is probably put in the Projects Editor folder. EditorApplication.currentScene is the attribute I want displayed. How do I append/replace the Hierarchy window text or create a subitem in it?
Have you done any research before co$$anonymous$$g here ?
https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/writing-plugins
Answer by Bunny83 · Jun 10, 2015 at 04:05 PM
I'm a bit confused. Where do you want to "display" the scene name? You know that the scene name is already in the main windows title bar? It's the second item after "Unity* - " and is followed by the project name and the targetplatform, at least on Windows ^^.
Extending the HierarchyPanel is something that isn't really supported by the editor. However you can create an EditorWindow that shows the scene name:
// SceneNameDisplay.cs located in an "/Editor/" folder
using UnityEngine;
using UnityEditor;
public class SceneNameDisplay : EditorWindow
{
[MenuItem("Tools/Display Scene Name")]
static void Init()
{
GetWindow<SceneNameDisplay>();
}
void OnEnable()
{
// allow the window to be smaller than the default min size.
minSize = new Vector2(20,20);
}
void OnGUI()
{
GUILayout.Label(EditorApplication.currentScene);
}
}
Not sure why someone needs this, but, well everyone is different ^^.
edit
Here's how it would look like when docked above the hierarchy view: