From a7100206ce1189cd62fa852069a036de5f77712a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dino=20Fejzagi=C4=87?= Date: Mon, 3 Jun 2024 19:02:38 +0200 Subject: [PATCH] Remove Enable() / Disable() overrides --- .../ConsoleDiagnosticsServiceModule.cs | 8 ++--- Runtime/DiagnosticsService.cs | 31 ++++--------------- .../FrameDiagnosticsServiceModule.cs | 6 +--- 3 files changed, 9 insertions(+), 36 deletions(-) diff --git a/Runtime/ConsoleDiagnostics/ConsoleDiagnosticsServiceModule.cs b/Runtime/ConsoleDiagnostics/ConsoleDiagnosticsServiceModule.cs index a0799d8..1548949 100644 --- a/Runtime/ConsoleDiagnostics/ConsoleDiagnosticsServiceModule.cs +++ b/Runtime/ConsoleDiagnostics/ConsoleDiagnosticsServiceModule.cs @@ -23,10 +23,8 @@ public ConsoleDiagnosticsServiceModule(string name, uint priority, BaseProfile p } /// - public override void Enable() + public override void Start() { - base.Enable(); - if (DiagnosticsService != null) { Application.logMessageReceived += DiagnosticsService.RaiseLogReceived; @@ -34,10 +32,8 @@ public override void Enable() } /// - public override void Disable() + public override void Destroy() { - base.Disable(); - if (DiagnosticsService != null) { Application.logMessageReceived -= DiagnosticsService.RaiseLogReceived; diff --git a/Runtime/DiagnosticsService.cs b/Runtime/DiagnosticsService.cs index cbf2077..793be73 100644 --- a/Runtime/DiagnosticsService.cs +++ b/Runtime/DiagnosticsService.cs @@ -71,17 +71,6 @@ public override void Initialize() frameEventData = new FrameEventData(currentEventSystem); consoleEventData = new ConsoleEventData(currentEventSystem); memoryEventData = new MemoryEventData(currentEventSystem); - } - - /// - public override void Enable() - { - base.Enable(); - - if (!Application.isPlaying) - { - return; - } if (profile.ShowDiagnosticsWindowOnStart == AutoStartBehavior.AutoStart) { @@ -90,24 +79,13 @@ public override void Enable() } /// - public override void Disable() + public override void Destroy() { - base.Disable(); - - if (!Application.isPlaying) { return; } - - if (diagnosticsWindow != null) + if (diagnosticsWindow.IsNotNull()) { Unregister(diagnosticsWindow); } - } - - /// - public override void Destroy() - { - base.Destroy(); - diagnosticsWindow.Destroy(); if (!diagnosticsRoot.IsNull() && @@ -166,7 +144,10 @@ public bool IsWindowEnabled get => DiagnosticsWindow.activeInHierarchy && isWindowEnabled; set { - if (isWindowEnabled == value) { return; } + if (isWindowEnabled == value) + { + return; + } isWindowEnabled = value; DiagnosticsWindow.SetActive(isWindowEnabled); diff --git a/Runtime/FrameDiagnostics/FrameDiagnosticsServiceModule.cs b/Runtime/FrameDiagnostics/FrameDiagnosticsServiceModule.cs index 78b044a..7b3fc5f 100644 --- a/Runtime/FrameDiagnostics/FrameDiagnosticsServiceModule.cs +++ b/Runtime/FrameDiagnostics/FrameDiagnosticsServiceModule.cs @@ -74,12 +74,8 @@ private int DeviceTargetRefreshRate #region IService Implementation /// - public override void Enable() + public override void Start() { - base.Enable(); - - if (!Application.isPlaying) { return; } - stopwatch.Restart(); }