public IEnumerator NearInteractionTouchableUnityUiButton()
        {
            var canvas = UnityUiUtilities.CreateCanvas(0.002f);

            var button = UnityUiUtilities.CreateButton(Color.gray, Color.blue, Color.green);

            button.transform.SetParent(canvas.transform, false);
            var text = UnityUiUtilities.CreateText("test");

            text.transform.SetParent(button.transform, false);

            Vector3 pressedPosition = objectPosition + Vector3.forward * 0.05f;

            canvas.transform.position = objectPosition;

            yield return(new WaitForFixedUpdate());

            yield return(null);

            yield return(PlayModeTestUtilities.ShowHand(Handedness.Right, inputSim));

            using (var catcher = new UnityButtonEventCatcher(button))
            {
                // Touch started and completed when entering and exiting
                yield return(PlayModeTestUtilities.MoveHand(initialHandPosition, pressedPosition, ArticulatedHandPose.GestureId.Open, Handedness.Right, inputSim));

                Assert.AreEqual(0, catcher.Click);
                yield return(PlayModeTestUtilities.MoveHand(pressedPosition + Vector3.forward * 0.05f, initialHandPosition, ArticulatedHandPose.GestureId.Open, Handedness.Right, inputSim));

                Assert.AreEqual(1, catcher.Click);
            }

            Object.Destroy(canvas.gameObject);
        }
        public IEnumerator NearInteractionTouchableUnityUiToggle()
        {
            var canvas = UnityUiUtilities.CreateCanvas(0.002f);

            var toggle = UnityUiUtilities.CreateToggle(Color.gray, Color.blue, Color.green);

            toggle.transform.SetParent(canvas.transform, false);
            var text = UnityUiUtilities.CreateText("test");

            text.transform.SetParent(toggle.transform, false);

            Vector3 pressedPosition = objectPosition + Vector3.forward * 0.05f;

            canvas.transform.position = objectPosition;

            yield return(new WaitForFixedUpdate());

            yield return(null);

            yield return(PlayModeTestUtilities.ShowHand(Handedness.Right, inputSim));

            using (var catcher = new UnityToggleEventCatcher(toggle))
            {
                // Turn on the toggle after exiting
                yield return(PlayModeTestUtilities.MoveHand(initialHandPosition, pressedPosition, ArticulatedHandPose.GestureId.Open, Handedness.Right, inputSim));

                Assert.IsFalse(catcher.IsOn);
                Assert.AreEqual(0, catcher.Changed);
                yield return(PlayModeTestUtilities.MoveHand(pressedPosition, initialHandPosition, ArticulatedHandPose.GestureId.Pinch, Handedness.Right, inputSim));

                Assert.IsTrue(catcher.IsOn);
                Assert.AreEqual(1, catcher.Changed);

                // Turn off the toggle after exiting
                yield return(PlayModeTestUtilities.MoveHand(initialHandPosition, pressedPosition, ArticulatedHandPose.GestureId.Open, Handedness.Right, inputSim));

                Assert.IsTrue(catcher.IsOn);
                Assert.AreEqual(1, catcher.Changed);
                yield return(PlayModeTestUtilities.MoveHand(pressedPosition, initialHandPosition, ArticulatedHandPose.GestureId.Pinch, Handedness.Right, inputSim));

                Assert.IsFalse(catcher.IsOn);
                Assert.AreEqual(2, catcher.Changed);
            }

            Object.Destroy(canvas.gameObject);
        }