Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Button press event firing twice?

Discussion in 'Input System' started by petey, May 19, 2020.

  1. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,773
    Hi all,

    Just getting started on the new input system and it's ace! But I'm having this issue where a press event seems to be happening twice when it should only occur once.

    I have a simple button action -
    Screen Shot 2020-05-19 at 11.23.37 am.png

    With a Unity event -
    Screen Shot 2020-05-19 at 11.19.35 am.png
    Code (CSharp):
    1. public void Input_SpecialToggle(InputAction.CallbackContext context)
    2.     {
    3.         var value = context.ReadValue<Single>();
    4.         Debug.Log("value = " + value);
    5.     }
    And when I press and release I get this in the console -
    Screen Shot 2020-05-19 at 11.17.07 am.png

    Any ideas? Thanks,
    Pete
     
  2. Pavulon

    Pavulon

    Joined:
    Jul 16, 2015
    Posts:
    2
  3. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,773
    Great thanks Pawel!