Skip to content

Fix FollowMeToggle's auto-follow breaking if the component is disabled#10620

Merged
keveleigh merged 2 commits into
microsoft:mainfrom
kevinfoley:kevinfoley-fix-followmetoggle
May 31, 2022
Merged

Fix FollowMeToggle's auto-follow breaking if the component is disabled#10620
keveleigh merged 2 commits into
microsoft:mainfrom
kevinfoley:kevinfoley-fix-followmetoggle

Conversation

@kevinfoley

Copy link
Copy Markdown
Contributor

Overview

FollowMeToggle has an AutoFollowAtDistance feature which breaks if the FollowMeToggle component is ever disabled and re-enabled. This is because the AutoFollowAtDistance property setter checks if the autoFollowDistanceCheck coroutine is null before starting the coroutine. If the component is disabled, the coroutine will stop but not become null. When the component is re-enabled, the coroutine does not start again because the previous instance is non-null, even though it is no longer running.

This is fixed by simply setting autoFollowDistanceCheck to null in OnDisable().

Changes

…sabled

`FollowMeToggle` has an `AutoFollowAtDistance` feature which breaks if the `FollowMeToggle` component is ever disabled and re-enabled. This is because the `AutoFollowAtDistance` property setter checks if the `autoFollowDistanceCheck` coroutine is null before starting the coroutine. If the component is disabled, the coroutine will _stop_ but not become null. When the component is re-enabled, the coroutine does not start again because the previous instance is non-null, even though it is no longer running.

This is fixed by simply setting `autoFollowDistanceCheck` to null in `OnDisable()`.
@kevinfoley kevinfoley requested a review from julenka as a code owner May 27, 2022 23:25
Comment thread Assets/MRTK/SDK/Features/UX/Scripts/Slate/FollowMeToggle.cs Outdated
Comment thread Assets/MRTK/SDK/Features/UX/Scripts/Slate/FollowMeToggle.cs Outdated
@keveleigh

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Per keveleigh

Co-authored-by: Kurtis <kurtie@microsoft.com>
@keveleigh

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@keveleigh keveleigh merged commit 2cb1d75 into microsoft:main May 31, 2022
keveleigh added a commit to keveleigh/HoloToolkit-Unity that referenced this pull request May 31, 2022
microsoft#10620)

* Fix FollowMeToggle's auto-follow breaking if the component is ever disabled

`FollowMeToggle` has an `AutoFollowAtDistance` feature which breaks if the `FollowMeToggle` component is ever disabled and re-enabled. This is because the `AutoFollowAtDistance` property setter checks if the `autoFollowDistanceCheck` coroutine is null before starting the coroutine. If the component is disabled, the coroutine will _stop_ but not become null. When the component is re-enabled, the coroutine does not start again because the previous instance is non-null, even though it is no longer running.

This is fixed by simply setting `autoFollowDistanceCheck` to null in `OnDisable()`.

* FollowMeToggle: formatting tweak

Per keveleigh

Co-authored-by: Kurtis <kurtie@microsoft.com>

Co-authored-by: Kurtis <kurtie@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FollowMeToggle's auto-follow breaks if the component is ever disabled

2 participants