Skip to content

Commit

Permalink
Fix errors from song loading being cancelled by an error/the rescan w…
Browse files Browse the repository at this point in the history
…arning
  • Loading branch information
TheNathannator committed Mar 21, 2024
1 parent 506e1cf commit 89a9d86
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Assets/Script/Gameplay/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ private void OnDestroy()
Navigator.Instance.NavigationEvent -= OnNavigationEvent;
}
GlobalVariables.AudioManager.SongEnd -= OnAudioEnd;
_songRunner.Dispose();
BeatEventHandler.Unsubscribe(StarPowerClap);
_songRunner?.Dispose();
BeatEventHandler?.Unsubscribe(StarPowerClap);
BackgroundManager.Dispose();

// Reset the time scale back, as it would be 0 at this point (because of pausing)
Expand Down
5 changes: 3 additions & 2 deletions Assets/Script/Gameplay/GameplayBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ protected void Awake()
// Protected to warn when hidden by an inheriting class
protected void OnDestroy()
{
GameplayDestroy();
if (GameManager == null)
return;

if (GameManager == null) return;
GameplayDestroy();

GameManager.ChartLoaded -= _OnChartLoaded;
GameManager.SongLoaded -= _OnSongLoaded;
Expand Down
3 changes: 3 additions & 0 deletions Assets/Script/Integration/StageKit/StageKitGameplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ private void HandleVenue(LightingType lightingEvent)

protected override void GameplayDestroy()
{
if (_controller == null)
return;

_controller.AllLedsOff();
KillCue();
_controller.StageKits.ForEach(kit => kit.ResetHaptics());
Expand Down

0 comments on commit 89a9d86

Please sign in to comment.