// Use this for initialization
    void Awake()
    {
        Instance = this;

        // Set up a GestureRecognizer to detect Select gestures.
        recognizer              = new UnityEngine.XR.WSA.Input.GestureRecognizer();
        recognizer.TappedEvent += (source, tapCount, ray) => {
            // Debug.Log(TAG + ": clicker event triggered");
            //   status.text = count.ToString();
            count += 1;
            GetComponent <GetTransform>().count = count;
            eventClickerClick.Invoke();
        };
        recognizer.StartCapturingGestures();
    }
Example #2
0
        private void HandleClickInput()
        {
            // do nothing if player clicked on a UI element
            if (EventSystem.current.IsPointerOverGameObject())
            {
                return;
            }
            if (mouse.Up && !mouse.IsDragging)
            {
                Transform target = RaycastFromScreen(mouse.ScreenPosition, clickableLayers);
                if (target != null)
                {
                    ClickInput?.Invoke(target);
                }
            }

            Transform RaycastFromScreen(Vector3 screenPoint, LayerMask targetLayers)
            {
                Ray ray = mainCamera.ScreenPointToRay(screenPoint);

                if (Physics.Raycast(ray, out RaycastHit hitInfo, Mathf.Infinity, targetLayers))
                {
                    return(hitInfo.collider.transform.parent);
                }