Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Using actions with modifier keys

Discussion in 'Input System' started by Blavek, Aug 16, 2020.

  1. Blavek


    Aug 7, 2015
    I currently have and Action set up for selecting game objects. I'd like its behavior to be altered when a modifier key is pressed.

    Naturally I could set up an action for select with and without modifier but this doesn't seem like the best way to do it.

    Is it possible using one action to have both styles of control and then in the OnSelect method in my input handler determine whether it was fired with or w/o the modifier being held?

    For some clarity

    I am using the PlayerInput component with the SendMessages behavior. Is there a context available to me in the event function without reading the modifier directly or using the InputAction select += ctx => Select(ctx); paradigm?


    Edit: Did a little testing and as two separate actions when control is held both actions fire. If I use only ButtonWith1Modifier, Action doesn't fire when control is not held down and fires when it is this is I suppose to be expected but what is the value of having a binding with a modifier if I can't differentiate the two? Is there something I am missing?
    Last edited: Aug 16, 2020