mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
GUIConsole: don't show in Unity Editor, we already have the Console window there (but keep it as option)
This commit is contained in:
parent
357e798e25
commit
d9ef6d855c
@ -37,8 +37,12 @@ public class GUIConsole : MonoBehaviour
|
|||||||
// and drawing would get slower and slower.
|
// and drawing would get slower and slower.
|
||||||
public int maxLogCount = 50;
|
public int maxLogCount = 50;
|
||||||
|
|
||||||
|
// Unity Editor has the Console window, we don't need to show it there.
|
||||||
|
// unless for testing, so keep it as option.
|
||||||
|
public bool showInEditor = false;
|
||||||
|
|
||||||
// log as queue so we can remove the first entry easily
|
// log as queue so we can remove the first entry easily
|
||||||
Queue<LogEntry> log = new Queue<LogEntry>();
|
readonly Queue<LogEntry> log = new Queue<LogEntry>();
|
||||||
|
|
||||||
// hotkey to show/hide at runtime for easier debugging
|
// hotkey to show/hide at runtime for easier debugging
|
||||||
// (sometimes we need to temporarily hide/show it)
|
// (sometimes we need to temporarily hide/show it)
|
||||||
@ -49,8 +53,13 @@ public class GUIConsole : MonoBehaviour
|
|||||||
bool visible;
|
bool visible;
|
||||||
Vector2 scroll = Vector2.zero;
|
Vector2 scroll = Vector2.zero;
|
||||||
|
|
||||||
|
// only show at runtime, or if showInEditor is enabled
|
||||||
|
bool show => !Application.isEditor || showInEditor;
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
|
// only show at runtime, or if showInEditor is enabled
|
||||||
|
if (show)
|
||||||
Application.logMessageReceived += OnLog;
|
Application.logMessageReceived += OnLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +99,7 @@ void OnLog(string message, string stackTrace, LogType type)
|
|||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
if (Input.GetKeyDown(hotKey))
|
if (show && Input.GetKeyDown(hotKey))
|
||||||
visible = !visible;
|
visible = !visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user