Search Unity

Question [Solved] Change action map while holding button and reset on release

Discussion in 'Input System' started by King_of_L1mbs, Nov 20, 2022.

  1. King_of_L1mbs

    King_of_L1mbs

    Joined:
    Jun 15, 2019
    Posts:
    22
    I am trying to wrap my head around controling a radial menu. When I hold a button (e.g. right shoulder/RB) I need to stop the left stick to move my character and navigate the menu instead. But what happens on changing the action map by pressing/holding RB is it gets immediatly canceled and wont register its release on letting it go after that to close the menu. Of course I could code that functionality into/around my movement action map but then what would I need an action map for at all - doesn't feel like doing it right.
    Is there any way to carry over that pressed state to the UI action map so I can find out when its released?
     
  2. King_of_L1mbs

    King_of_L1mbs

    Joined:
    Jun 15, 2019
    Posts:
    22
    Alright, figured it out myself. On the UI action map for the menu button action check the box "Initial State Check" which registers the button as held after switching to the map. This is turned off by default.
     
    phootrf likes this.
  3. phootrf

    phootrf

    Joined:
    Jun 22, 2023
    Posts:
    1
    I do thread necromancy to drive home the point this solved my very similiar problem. I have a "run" button and as long as it is being pressed, the character runs. Release it and the character moves. Switching action maps always canceled the run state, until I checked the Initial State Check box.

    Here's a full morning of trouble shooting that got solved by one single checkbox.