Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug new input system: Touchphase.Ended not called in the simulator ?

Discussion in 'Input System' started by peter_the_coder, Dec 28, 2020.

  1. peter_the_coder

    peter_the_coder

    Joined:
    Nov 28, 2017
    Posts:
    11
    Hi,
    can it be, that in the simulator for the new input system the touchphase.ended is not called in the simulator ?

    I must admit, I am using: Input System 1.1.0 - preview 2
    (hope this is not a proplem of the preview version)

    in Input Debug - I have actived the "Simulate Touch from Mouse or Pen" also in the Script

    than I have the following code:

    Code (CSharp):
    1. using UnityEngine.InputSystem.EnhancedTouch;
    2. using Touch = UnityEngine.InputSystem.EnhancedTouch.Touch;
    Code (CSharp):
    1. private  Touch activeTouch;
    2.  private void Awake() {
    3.          
    4.          _playerInput  = GetComponent<PlayerInput>();
    5.          EnhancedTouchSupport.Enable();
    6.  
    7.     }
    8.  
    and than in update

    Code (CSharp):
    1.    void Update()
    2.     {
    3.         if (Touch.activeFingers.Count == 1)
    4.         {
    5.             activeTouch = Touch.activeFingers[0].currentTouch;
    6.              Debug.Log($"Phase: {activeTouch.phase} | Position: {activeTouch.delta}");          
    7.             if (activeTouch.phase.IsEndedOrCanceled())
    8.             {
    9.                 Touchended();
    10.             }
    11.         }
    12.     }
    however IsEndedOrCanceled() is never called.. I see it also in the console



    any help highly appreciated
    thanks in advance
    Peter
     
  2. peter_the_coder

    peter_the_coder

    Joined:
    Nov 28, 2017
    Posts:
    11
    I had set in the Player Settings: Input System to Both.

    I added following code in update
    Code (CSharp):
    1. if (Input.touchCount > 0)
    2.         {
    3.            // activeTouch = Touch.activeFingers[0].currentTouch;
    4.  
    5.             if (Input.GetTouch(0).phase == UnityEngine.TouchPhase.Began)
    6.             {
    7.                 Debug.Log(Input.GetTouch(0).phase);
    8.             }
    9.             else if (Input.GetTouch(0).phase == UnityEngine.TouchPhase.Moved)
    10.             {
    11.                 Debug.Log(Input.GetTouch(0).phase);
    12.             }
    13.             else if (Input.GetTouch(0).phase == UnityEngine.TouchPhase.Ended)
    14.             {
    15.                 Debug.Log(Input.GetTouch(0).phase);
    16.             }
    17.         }
    here the Debug.Loglog displays "Ended" ..

    So I guess, thats a bug in the Input System 1.1.0 - Preview 2

    Going to change it to bug..