mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
[+] Editor Tool Bar
This commit is contained in:
@@ -60,9 +60,7 @@ namespace TEngine
|
||||
{
|
||||
// GUILayout.Label("资源加载模式:",ToolbarStyles.ToolBarTextStyle);
|
||||
|
||||
GUILayout.Space(2);
|
||||
|
||||
GUILayout.Label("");
|
||||
GUILayout.Space(10);
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
|
||||
|
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: acd9403857c068f4792b1a536a7b89f6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 252cc3ce82f9548b99943bfdadc9d4c0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8ddf5f9fafe5734dbae1d30d51bb2a6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user