Fix FollowMeToggle's auto-follow breaking if the component is disabled#10620
Merged
keveleigh merged 2 commits intoMay 31, 2022
Merged
Conversation
…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()`.
keveleigh
approved these changes
May 31, 2022
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Per keveleigh Co-authored-by: Kurtis <kurtie@microsoft.com>
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
FollowMeTogglehas anAutoFollowAtDistancefeature which breaks if theFollowMeTogglecomponent is ever disabled and re-enabled. This is because theAutoFollowAtDistanceproperty setter checks if theautoFollowDistanceCheckcoroutine 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
autoFollowDistanceCheckto null inOnDisable().Changes