[+] Editor Tool Bar

This commit is contained in:
ALEXTANG
2023-05-12 23:28:00 +08:00
parent d64a7d6777
commit de0d4e58a5
5 changed files with 1 additions and 88 deletions

View File

@@ -60,9 +60,7 @@ namespace TEngine
{
// GUILayout.Label("资源加载模式:",ToolbarStyles.ToolBarTextStyle);
GUILayout.Space(2);
GUILayout.Label("");
GUILayout.Space(10);
GUILayout.FlexibleSpace();

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: acd9403857c068f4792b1a536a7b89f6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 252cc3ce82f9548b99943bfdadc9d4c0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,58 +0,0 @@
using UnityEditor;
using UnityEngine;
namespace UnityToolbarExtender.Examples
{
[InitializeOnLoad]
public static class SceneViewFocuser
{
static bool m_enabled;
static bool Enabled
{
get { return m_enabled; }
set
{
m_enabled = value;
EditorPrefs.SetBool("SceneViewFocuser", value);
}
}
static SceneViewFocuser()
{
m_enabled = EditorPrefs.GetBool("SceneViewFocuser", false);
EditorApplication.playModeStateChanged += OnPlayModeChanged;
EditorApplication.pauseStateChanged += OnPauseChanged;
ToolbarExtender.RightToolbarGUI.Add(OnToolbarGUI);
}
static void OnPauseChanged(PauseState obj)
{
if (Enabled && obj == PauseState.Unpaused)
{
// Not sure why, but this must be delayed
EditorApplication.delayCall += EditorWindow.FocusWindowIfItsOpen<SceneView>;
}
}
static void OnPlayModeChanged(PlayModeStateChange obj)
{
if (Enabled && obj == PlayModeStateChange.EnteredPlayMode)
{
EditorWindow.FocusWindowIfItsOpen<SceneView>();
}
}
static void OnToolbarGUI()
{
var tex = EditorGUIUtility.IconContent(@"UnityEditor.SceneView").image;
GUI.changed = false;
GUILayout.Toggle(m_enabled, new GUIContent(null, tex, "Focus SceneView when entering play mode"), "Command");
if (GUI.changed)
{
Enabled = !Enabled;
}
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c8ddf5f9fafe5734dbae1d30d51bb2a6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: