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 MultiTap not working with Keyboard/Mouse + Gamepad active simultaneously

Discussion in 'Input System' started by Lucideus, May 21, 2020.

  1. Lucideus

    Lucideus

    Joined:
    Dec 7, 2015
    Posts:
    25
    I do suspect this is a bug but I might just be doing something wrong here, if so, help would be appreciated!
    I'm currently attempting to do a Barrel Roll by either double tapping Shift or double tapping the Right Trigger on a gamepad.

    I do so by adding a BarrelRoll action and adding a MultiTap interaction to it, with the ActionType left as a Button.
    Adding only one Binding, say Left Shift and assigning it to Mouse/Keyboard(Control scheme), it works just fine. It responds to the double tap as expected.
    However, if I add another binding it just refuses to work if my gamepad is plugged in. It doesn't matter if its assigned to my Gamepad control scheme or not - as long as it's plugged in and if there are more than one binding, it will not trigger. Only if I remove one of the bindings or unplug the gamepad will it work.

    Any help would be appreciated to understand what's goin on here! inputSettings1.png

    inputKB.png

    InputGP.png
    I would suspect it was my code but as a I said - it works perfectly fine as long as there's only *one* binding present or if the gamepad isn't plugged in, but in case it's to any use here's the simple code:
    Code (CSharp):
    1. public sealed class BarrelRoll : MonoBehaviour
    2. {
    3.  
    4.         [SerializeField] private float _BarrelRollDuration;
    5.         [SerializeField] private Transform _Model;
    6.         [SerializeField] private PlayerController _PlayerController;
    7.  
    8.         private Controls _Controls;
    9.  
    10.         private void Awake() => _Controls = new Controls();
    11.         private void OnEnable() => _Controls.Player.BarrelRoll.Enable();
    12.         private void OnDisable() => _Controls.Player.BarrelRoll.Disable();
    13.  
    14.         private void Update()
    15.         {
    16.             var input = _Controls.Player.BarrelRoll.triggered;
    17.  
    18.             if (input && !_InBarrelRoll)
    19.             {
    20.                 HandleBarrelRoll();
    21.             }
    22.         }
    23.  
    24.         private void HandleBarrelRoll()
    25.         {
    26.             if (!_Model)
    27.                 return;
    28.  
    29.             var direction = _PlayerController.XDirection;
    30.  
    31.             _Model.DOLocalRotate(new Vector3(_Model.localEulerAngles.x, _Model.localEulerAngles.y, 360 * -direction),  _BarrelRollDuration, RotateMode.LocalAxisAdd).SetEase(Ease.OutSine);
    32.         }
    33. }
    Excuse the strange formatting.

    Edit: Just as an update, if I set the Tap Count to 1 then it does trigger the barrel roll but obviously not the way I want it to because I want it as a multitap, not a single tap.
     
    Last edited: May 22, 2020
    vectorized-runner likes this.
  2. Eugenio

    Eugenio

    Joined:
    Mar 21, 2013
    Posts:
    197
    I second this post: the MultiTap doesn't work !!
    Setting a TapCount > 1, the performed action will not be triggered therefore there is no way to register the wanted action.
    lf TapCount == 1 then all works properly but, of course, it's not what I want from a multitap behaviour :p

    Is there anyone from Unity that can help with this, please?

    Thank you very much :)
     
  3. Zaine7673

    Zaine7673

    Joined:
    Feb 15, 2018
    Posts:
    238
    I'm also having some issues with double taps. My setup is as such

    upload_2020-6-14_12-13-2.png

    Tested some of the things you guys said and can confirm that it seems to be an issue.

    Controller unplugged = keyboard double tap works as expected
    controller plugged in = no double taps work. not on keyboard or controller.
    setting tap amount to 1 = works for both keyboard and controller but again this isn't what we want.

    would be nice to get a response from someone at Unity about this :)
     
  4. vectorized-runner

    vectorized-runner

    Joined:
    Jan 22, 2018
    Posts:
    383
    Same issue. Multi tap does not work at all.
     
  5. Eugenio

    Eugenio

    Joined:
    Mar 21, 2013
    Posts:
    197
    Update on this: I'm not sure if a bug report was submitted about this issue, so, I made one.

    You can check its status here:
    http://fogbugz.unity3d.com/default.asp?1267805_9jndm3div6phpa8h

    Cheers !! :)

    UPDATE:
    I attached to this message the Unity project submitted to test the bug.
    To test it yourself:
    - double tap the Gamepad south button
    - double click the Mouse left button
    - double click the Keyboard space key
    - double tap on the Touchscreen of your mobile device (only on Android or iOS builds)
    Depending on the selected mode, the double tap will work or not.
     

    Attached Files:

    Last edited: Aug 3, 2020
    RedEarth likes this.
  6. RedEarth

    RedEarth

    Joined:
    Nov 4, 2016
    Posts:
    19
    Same Issue. Multi Tap isn't working. The button triggers as if it was a regular press. However if checking for Interaction, it fails.
     
  7. teknochaos

    teknochaos

    Joined:
    Oct 6, 2019
    Posts:
    5
    I have exactly the same issue. I solved it by making "Action Type" pass through. I kept control type as button. Ekran Görüntüsü (129).png


    Then I add interaction to binding. And it worked Ekran Görüntüsü (130).png


    Also I had a problem with Hold interaciton. My problem is that performed state is just happening once. I mean if i perform it once then it will never perform again. I solved it by making pass through, too. Then added interaction to binding, again.
     
    nicemiceinice and Ahmed_Negm like this.
  8. Ahmed_Negm

    Ahmed_Negm

    Joined:
    Mar 14, 2018
    Posts:
    1
    This helped very much thank you
     
  9. visca_c

    visca_c

    Joined:
    Apr 7, 2014
    Posts:
    27
    this did not work for me, double tap just won't trigger.
     
  10. Volchok

    Volchok

    Joined:
    Jul 26, 2017
    Posts:
    127
    I also have the same problem in Unity 2022.1.5f1. :( What I just did not, double-click on the screen does not work. Only the .started and .cancelled events work. Is this really a bug or am I doing something wrong? :eek: On the tablet itself, double-click works both to wake the tablet from sleep and simply in other applications and games. Has anyone overcomed this trouble?

    Code (CSharp):
    1. private void AddListeners()
    2.         {
    3.             _controlls.Enter.MultiTouch.started += _ => Started();
    4.             _controlls.Enter.MultiTouch.canceled += _ => Canceled();
    5.             _controlls.Enter.MultiTouch.performed += _ => Peformed();
    6.         }
    7.  
    8.         private void RemoveListeners()
    9.         {
    10.             _controlls.Enter.MultiTouch.started -= _ => Started();
    11.             _controlls.Enter.MultiTouch.canceled -= _ => Canceled();
    12.             _controlls.Enter.MultiTouch.performed -= _ => Peformed();
    13.         }
    14.  
    15.         private void Started()
    16.         {
    17.             Debug.LogError("Started!");
    18.         }
    19.      
    20.         private void Canceled()
    21.         {
    22.             Debug.LogError("Canceled!");
    23.         }
    24.      
    25.         private void Peformed()
    26.         {
    27.             Debug.LogError("Peformed!");
    28.             EventManager.TriggerEvent(CEvents.ON_MULTI_TOUCH);
    29.         }


     
  11. andrew_oc

    andrew_oc

    Unity Technologies

    Joined:
    Apr 16, 2021
    Posts:
    77
    You might need to bind to "Primary Touch/Press" there, or "Primary Touch/Tap". "Primary Touch/Position" is for the actual touch position on the screen, and for multi-tap, you need the actuation level of the control to go from not actuated to actuated and back again.
     
    Volchok likes this.
  12. Volchok

    Volchok

    Joined:
    Jul 26, 2017
    Posts:
    127
    Thank you a lot! You're right!
    Yes, everything worked with: Touchscreen-->touch*/Press[Touchscreen] :):):)