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 NearInteractionTouchableDistance()
        {
            var touchableRect = CreateTouchable <NearInteractionTouchable>(0.15f);

            touchableRect.SetLocalForward(touchNormal);
            touchableRect.SetBounds(new Vector2(0.5f, 0.5f));
            CreateTouchEventCatcher(touchableRect);

            var touchableVolume = CreateTouchable <NearInteractionTouchableVolume>(0.15f);

            CreateTouchEventCatcher(touchableVolume);

            var canvas      = UnityUiUtilities.CreateCanvas(0.002f);
            var touchableUI = canvas.GetComponent <NearInteractionTouchableUnityUI>();
            var button      = UnityUiUtilities.CreateButton(Color.gray, Color.blue, Color.green);

            button.transform.SetParent(touchableUI.transform, false);
            // This constructor assigns an event handler, but the actual object isn't needed
            _ = new UnityButtonEventCatcher(button);

            yield return(new WaitForFixedUpdate());

            yield return(null);

            touchableRect.gameObject.name   = "Rect Touchable";
            touchableVolume.gameObject.name = "Volume Touchable";
            touchableUI.gameObject.name     = "UnityUI Touchable";

            float distSurface = 0.3f;

            touchableRect.transform.position   = new Vector3(-1, 0, distSurface);
            touchableVolume.transform.position = new Vector3(0, 0, distSurface);
            touchableUI.transform.position     = new Vector3(1, 0, distSurface);

            yield return(TestTouchableDistances(touchableRect, 0.0075f, touchableRect.gameObject));

            yield return(TestTouchableDistances(touchableVolume, 0.0075f, touchableVolume.gameObject));

            yield return(TestTouchableDistances(touchableUI, 0.0f, button.gameObject));

            Object.Destroy(touchableRect.gameObject);
            Object.Destroy(touchableVolume.gameObject);
            Object.Destroy(touchableUI.gameObject);
        }