Search Unity

Bug Ciclying ActionMaps with Actions with the same binding path triggers event on the new one

Discussion in 'Input System' started by Fira-Soft, Feb 23, 2023.

  1. Fira-Soft

    Fira-Soft

    Joined:
    Sep 9, 2014
    Posts:
    26
    2 ActionMaps have the same binding path (key) defined for some action. Only one is active. When disabling the old ActionMap and enabling the new one, the event (button press) triggers for the new ActionMap, even with Initial State Check disabled.

    My use case: I have a map and an ActionMap that handles when user is open the map. Player should press M to open the map and press M again to close it. When Player press M, I enable the map Canvas, this will enable the Map ActionMap. Since there is a callback already set for the Action to close the map, it will be triggered, closing the map again.

    Same thing happens if enabling/disabling is done inside the callback instead of OnEnable/OnDisable

    This happens with Unity 2021.3.19 and Input System 1.5.0 (also tested on and 2021.1.28 and 1.3.0)
     

    Attached Files:

    berber_hunter likes this.
  2. Fira-Soft

    Fira-Soft

    Joined:
    Sep 9, 2014
    Posts:
    26
    After more testing, this seems to only happens with
    perfomed
    event, for the button action type.
    started
    or
    canceled
    doesn't seem to leek from one action map to another.
     
    berber_hunter likes this.
  3. berber_hunter

    berber_hunter

    Joined:
    Apr 30, 2021
    Posts:
    14
    Same here with Input System 1.5.1 and Unity 2022.3
    I thought it was because the controls shared the same name. But from your example it's likely because they share the same control.
     
  4. berber_hunter

    berber_hunter

    Joined:
    Apr 30, 2021
    Posts:
    14
    Changing they control ActionType to Button from PassThrough helped.