Search Unity

How do I…? …wait for any button to be pressed on any device?

Discussion in 'Input System' started by steinbitglis, Apr 28, 2021.

  1. steinbitglis

    steinbitglis

    Joined:
    Sep 22, 2011
    Posts:
    254
    Hey! Is this supposed to be working?
    wait_for_any_button.png

    I can only get
     
  2. becneljj

    becneljj

    Joined:
    May 14, 2021
    Posts:
    1
    Had the same issue. Try this instead:

    Code (CSharp):
    1. InputAction myAction = new InputAction(binding: "/*/<button>");
    2. myAction.performed += context => Debug.Log($"Button {context.control.device.name} device {context.control.name} pressed!");
    3. myAction.Enable();