- Home /
Unity input system: TapInteraction does not produce a value when using ReadValue()
I'm trying to create a keyboard binding that rotates my player when tapping the keyboard (holding down would move the character).
This is my simple setup:
I'm using Unity Events with the following code.
public void OnTurn(InputAction.CallbackContext moveContext){
if(moveContext.performed){
if(moveContext.interaction is TapInteraction){
Debug.Log("tap");
Debug.Log(moveContext.ReadValue<Vector2>()); //returns an (0,0) vector
}
}
}
The vector returns (0,0), where I am expecting it to return a vector2 value based on the key pressed. I have a feeling that it has something to do with a tap not being long enough for an actuation to be registered, but I can't seem to fix it.
Any help is appreciated
Your answer
Follow this Question
Related Questions
Holding Ctrl prevents character from moving 2 Answers
Keyboard.current.onTextInput difference between shortcut or plain text 0 Answers
How to change the editor's keyboard to AZERTY layout? 1 Answer
Set Alt Positive/Negative Button input during runtime 0 Answers
Check if there is a keyboard input (not a specified key input) 2 Answers