Skip to content

Commit

Permalink
Remove Enable() / Disable() overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
FejZa committed Jun 3, 2024
1 parent 5114355 commit a710020
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 36 deletions.
8 changes: 2 additions & 6 deletions Runtime/ConsoleDiagnostics/ConsoleDiagnosticsServiceModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,17 @@ public ConsoleDiagnosticsServiceModule(string name, uint priority, BaseProfile p
}

/// <inheritdoc />
public override void Enable()
public override void Start()
{
base.Enable();

if (DiagnosticsService != null)
{
Application.logMessageReceived += DiagnosticsService.RaiseLogReceived;
}
}

/// <inheritdoc />
public override void Disable()
public override void Destroy()
{
base.Disable();

if (DiagnosticsService != null)
{
Application.logMessageReceived -= DiagnosticsService.RaiseLogReceived;
Expand Down
31 changes: 6 additions & 25 deletions Runtime/DiagnosticsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,6 @@ public override void Initialize()
frameEventData = new FrameEventData(currentEventSystem);
consoleEventData = new ConsoleEventData(currentEventSystem);
memoryEventData = new MemoryEventData(currentEventSystem);
}

/// <inheritdoc />
public override void Enable()
{
base.Enable();

if (!Application.isPlaying)
{
return;
}

if (profile.ShowDiagnosticsWindowOnStart == AutoStartBehavior.AutoStart)
{
Expand All @@ -90,24 +79,13 @@ public override void Enable()
}

/// <inheritdoc />
public override void Disable()
public override void Destroy()
{
base.Disable();

if (!Application.isPlaying) { return; }

if (diagnosticsWindow != null)
if (diagnosticsWindow.IsNotNull())
{
Unregister(diagnosticsWindow);
}

}

/// <inheritdoc />
public override void Destroy()
{
base.Destroy();

diagnosticsWindow.Destroy();

if (!diagnosticsRoot.IsNull() &&
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 1 addition & 5 deletions Runtime/FrameDiagnostics/FrameDiagnosticsServiceModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,8 @@ private int DeviceTargetRefreshRate
#region IService Implementation

/// <inheritdoc />
public override void Enable()
public override void Start()
{
base.Enable();

if (!Application.isPlaying) { return; }

stopwatch.Restart();
}

Expand Down

0 comments on commit a710020

Please sign in to comment.