- Home /
New Input System Hold/Tap stucks with numbers
Hi,
I wanted to give a button a Tap and Hold function with the New Input System. It is working fine so far, as I'm using letters and the Arrow Keys. My Setup is like this:
and my code is working like this:
private void Awake()
{
inputMappings = new InputMappings();
inputMappings.Control.Select.performed += ctx => HoldTap(ctx);
}
private void HoldTap(CallbackContext callbackcontext)
{
if (callbackcontext.interaction is TapInteraction)
Debug.Log("Tap" + callbackcontext.interaction);
else if (callbackcontext.interaction is HoldInteraction)
Debug.Log("Hold " + callbackcontext.interaction);
else
Debug.Log("other " + callbackcontext.interaction);
}
It recognizes the Differences between a tap and a hold. But when I'm using numbers (in my case 6 and 9) there are Problems: Tapping works fine. But as soon as I "hold" one time, the event is executed one time and after that the whole Input system stucks. Even my letter events, aren't wokring anymore. But no Errors Occur. I binded them like this:
I'm using the numeric keys above the letters, not the numpad (this has some Unity shortcuts).
And I have to use numbers (customer requirement) and i know I can do something with a selfmade Timer and .start/.performed or split in two Actions (which I did for now). But I'm interested if this is a bug, me doing something wrong or something from the editor?
Your answer
![](https://koobas.hobune.stream/wayback/20220613025004im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
codes for detecting mobile double tap and hold 1 Answer
Multitouch Hold and Move 0 Answers
Swipe and Hold to move character . 1 Answer
How do I make an Object be destroyed just by tapping it? 1 Answer