Skip to content

Commit 13f9389

Browse files
committed
Ensure async operations on progress indicators don't wait on animations if the object is hidden
1 parent 7ff796a commit 13f9389

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Assets/MRTK/SDK/Features/UX/Scripts/ProgressIndicators/ProgressIndicatorObjectDisplay.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public async Task OpenAsync()
100100

101101
float startTime = Time.unscaledTime;
102102
float openScale = 0f;
103-
while (openScale < 1)
103+
while (openScale < 1 && isActiveAndEnabled)
104104
{
105105
openScale = openCurve.Evaluate(Time.unscaledTime - startTime);
106106
scaleTargetObject.transform.localScale = Vector3.one * currentScale * openScale;
@@ -133,7 +133,7 @@ public async Task CloseAsync()
133133

134134
float startTime = Time.unscaledTime;
135135
float closeScale = 1f;
136-
while (closeScale > 0)
136+
while (closeScale > 0 && isActiveAndEnabled)
137137
{
138138
closeScale = closeCurve.Evaluate(Time.unscaledTime - startTime);
139139
scaleTargetObject.transform.localScale = Vector3.one * currentScale * closeScale;

Assets/MRTK/SDK/Features/UX/Scripts/ProgressIndicators/ProgressIndicatorOrbsRotator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public async Task CloseAsync()
8585

8686
StopOrbs();
8787

88-
while (!hasAnimationFinished)
88+
while (!hasAnimationFinished && isActiveAndEnabled)
8989
{
9090
await Task.Yield();
9191
}

0 commit comments

Comments
 (0)