From c9557b474abb98e70803ffc0c9ab1e1c4416412e Mon Sep 17 00:00:00 2001 From: Maddie <52103563+maddie480@users.noreply.github.com> Date: Wed, 11 Sep 2024 21:16:33 +0200 Subject: [PATCH] Fix various bugs related to Spinner Breaking Balls carried to other screens --- Entities/SpinnerBreakingBallGeneric.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Entities/SpinnerBreakingBallGeneric.cs b/Entities/SpinnerBreakingBallGeneric.cs index 2b7a1e4..e89409b 100644 --- a/Entities/SpinnerBreakingBallGeneric.cs +++ b/Entities/SpinnerBreakingBallGeneric.cs @@ -61,6 +61,12 @@ private void onTransitionOut() { // wipe the spinner connections so that they are computed again after the transition (in the new room). spinnerNeighbors = null; listOfSpinners = null; + shatteredSpinners.Clear(); + + // stop the running computation of spinner connections (if any) + computeSpinnerNeighborsToken?.Cancel(); + computeSpinnerNeighbors = null; + computeSpinnerNeighborsToken = null; } public override void Awake(Scene scene) { @@ -110,11 +116,11 @@ public override void Update() { public override void Removed(Scene scene) { base.Removed(scene); - computeSpinnerNeighborsToken.Cancel(); + computeSpinnerNeighborsToken?.Cancel(); } public override void SceneEnd(Scene scene) { base.SceneEnd(scene); - computeSpinnerNeighborsToken.Cancel(); + computeSpinnerNeighborsToken?.Cancel(); } private Task computeSpinnerConnections(CancellationToken cancelToken) {