Multiple interactions: can Press and Multi Tap co-exists on an action?

Hi,

I am using Player Input component’s Invoke Unity Events to receive input, and I would like to handle click and double click from my mouse.

Based on the manual, it appears we can set multiple interactions on a binding.

But how about an action??

Say I already had an action associate with mouse’s left button, set its action type to Button, added a Press Only interaction.

  • Can I add a Multi-tap interaction?

  • If so, how can my Monobehaviour script distinguish between the Press Only and Multi Tap event? Note that I am using Invoke Unity Event, so all I have is InputAction.CallbackContext.

Thx!

Answer:

CallbackContext has a interaction property that I can use to distinguish between interactions.

Which I can do a check like if (context.interaction is MultiTapInteraction) {}

Comment:

I would love Unity team to document it somewhere.

https://docs.unity3d.com/Packages/com.unity.inputsystem@1.1/api/UnityEngine.InputSystem.InputAction.CallbackContext.html#UnityEngine_InputSystem_InputAction_CallbackContext_interaction