Skip to content

Touch Input

VirtueSky edited this page Jul 25, 2024 · 3 revisions

What

  • Touch handling support tool for unity games (use Touch Phase)

Use

  • Attach TouchInputManager to the scene and click create InputEvent

Screenshot 2024-07-05 140313

  • Demo script uses TouchInputManager (move gameobject cube by touch or mouse)
        private void OnEnable()
        {
            TouchInputManager.InputEventTouchBegin += StartTouch;
            TouchInputManager.InputEventTouchMove += MoveTouch;
            TouchInputManager.InputEventTouchEnd += EndTouch;
            TouchInputManager.InputEventTouchStationary += StationTouch;
            TouchInputManager.InputEventTouchCancel += CancelTouch;

        }

        #region Touch

        private void StartTouch(Vector3 v3)
        {
            Debug.Log($"start: {v3}");
        }

        private void MoveTouch(Vector3 v3)
        {
            Debug.Log($"move: {v3}");
        }

        private void EndTouch(Vector3 v3)
        {
            Debug.Log($"end: {v3}");
        }

        private void StationTouch(Vector3 v3)
        {
            Debug.Log($"station: {v3}");
        }

        private void CancelTouch(Vector3 v3)
        {
            Debug.Log($"cancel: {v3}");
        }

        #endregion

     
Clone this wiki locally