-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Describe the bug
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 instance is null before starting the coroutine. If the instance is not null, the coroutine is not started.
However, in Unity, the fact that a coroutine instance is non-null does not indicate that that coroutine is actually running. If the component is disabled, the coroutine will stop but not become null. When FollowMeToggle is re-enabled, the autoFollowDistanceCheck coroutine is not restarted because the previous instance is non-null, even though it is no longer running.
To reproduce
Steps to reproduce the behavior:
- Add a Near Menu to a scene
- Select the Near Menu in the scene hierarchy
- In the Inspector, find the "Follow Me Toggle" component. Enable "Auto Follow At Distance"
- Enable Holographic Remoting for Play Mode (Mixed Reality > Remoting > Holographic Remoting for Play Mode)
- Put on the HoloLens and start the Holographic Remoting app
- Start the scene in the Unity Editor
- Walk away from the Near Menu to verify that the auto-follow behavior works as expected
- In the Unity Editor's Inspector, without stopping the scene, disable and re-enable the "Follow Me Toggle" component using the checkbox to the left of the component name
- Pin the Near Menu and try walking away from it again. Notice that the auto-follow behavior no longer works.
Expected behavior
"Auto Follow At Distance" behavior will continue to function after disabling and re-enabling the component.
Your setup (please complete the following information)
- Unity 2020.3.34f1
- MRTK Version 2.7.3.0 (this issue should apply to all versions of MRTK)
Target platform (please complete the following information)
- HoloLens 2