Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
May 31, 2022

Conversation

kevinfoley
Copy link
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
@keveleigh
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Per keveleigh

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

/azp run

@azure-pipelines
Copy link

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