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

How to manage multiple "Submit" inputs for PS4/XBox controllers?

Discussion in 'General Discussion' started by Gamrok, Feb 4, 2020.

  1. Gamrok

    Gamrok

    Joined:
    May 13, 2015
    Posts:
    16
    Hello,

    My game works fine with the PS4 and XBox controllers, but I have a small problem with the UI, especially with the "Submit" input.

    I have two "Submit" inputs in the "Input" settings:
    - The first one is set for the XBox controllers ("Alt Positive Button: joystick button 0") for button A
    - The second is set for the PS4 controllers ("Alt Positive Button: joystick button 1") for button X

    The problem, when I use a PS4 controller, is that the Square button is considered as a "Submit" button because its ID is the same as the button A of the XBox Controller.

    How can I disable one of these inputs? I would like to avoid interference between these two settings.
     
  2. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    9,804
  3. Gamrok

    Gamrok

    Joined:
    May 13, 2015
    Posts:
    16
    I already use GetJoystickNames() to select right inputs in other parts of my game but I can't do the same for "Submit".

    I don't know if this is a good way, but is it possible to override Button::OnSubmit() to know the ID of the button pressed? I could use GetJoystickNames() in this case.
     
  4. Gamrok

    Gamrok

    Joined:
    May 13, 2015
    Posts:
    16
    Or is there a way to modify dynamically the input parameters? (the "Alt Positive Button" in my case)

    I have a lot of buttons using the Button class in my game so I can't afford to use something else than the Submit input.
     
  5. Nubaa

    Nubaa

    Joined:
    Apr 30, 2013
    Posts:
    18
    Did you ever figure this out? I'm running into the same issue.