Reputation: 1
Is it possible to remove default menu buttons like the Play Pause buttons from the Unity editor? Also, can I add custom dropdowns in addition to the default dropdowns like Layers and Layout? Check the attached image for more clarification Ref mage
I tried researching the Editor scripting API but I dont find what I am looking for.
Upvotes: 0
Views: 93
Reputation: 116
don't know if you can remove already existing buttons or not but for adding new buttons Unity Toolbar Extender is a very good solution.
here's a sample code:
[InitializeOnLoad]
public class ToolbarExtend {
static ToolbarExtend()
{
ToolbarExtender.LeftToolbarGUI.Add(OnToolbarGUILeft);
ToolbarExtender.RightToolbarGUI.Add(OnToolbarGUIRight);
}
static void OnToolbarGUILeft()
{
GUILayout.FlexibleSpace();
if(GUILayout.Button(new GUIContent("Scenes", "Show Scenes"))) {
PingAndSelect(AssetDatabase.LoadMainAssetAtPath("Assets/Scenes/LoginScene.unity"));
}
}
static void OnToolbarGUIRight()
{
if(GUILayout.Button(new GUIContent("Build Folder", "Open Build Path")))
{
BuildNamingTool.Reset();
Debug.Log(BuildNamingTool.BuildFolder);
System.Diagnostics.Process.Start("explorer.exe", BuildNamingTool.BuildFolder.Replace("/", @"\"));
}
GUILayout.FlexibleSpace();
}
private static void PingAndSelect(Object target)
{
EditorGUIUtility.PingObject(target);
Selection.activeObject = target;
}
}
and Unity Circular Menu is a good solution for quick access to some options.
here's a sample code:
[CircularMenu(path: "Project Setting", icon: "Settings")]
public static void OpenProjectSetting()
{
SettingsService.OpenProjectSettings("Project/Player");
}
[CircularMenu(path: "PlayerPrefs", icon: "Preset.Context")]
public static void OpenPlayerPrefs()
{
EditorApplication.ExecuteMenuItem("Window/PlayerPrefs Editor");
}
[CircularMenu(path: "Clear PlayerPrefs", icon: "TreeEditor.Trash")]
public static void ClearPlayerPrefs()
{
PlayerPrefs.DeleteAll();
PlayerPrefs.Save();
}
Upvotes: 0