Search Unity

Using a joystick axis for different buttons

Discussion in 'Input System' started by flipwon, Jun 23, 2020.

  1. flipwon

    flipwon

    Joined:
    Dec 29, 2016
    Posts:
    179
    Is it possible to set a specific joystick axis to a button?

    Ex: Action Jump = press right on joystick or dpad
     
    Last edited: Jun 23, 2020
  2. mikewarren

    mikewarren

    Joined:
    Apr 21, 2014
    Posts:
    109
    I'm just learning the system myself, but the gamepad device has up, down, left, right bindings for the left/right stick and dpad. They act like buttons. The joystick device has them, too. Does that help?
     
  3. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,555
    If you need to customize input beyond what's possible by default you can just wrap things in your own class, i.e. instead of calling Input.GetAxis("Vertical"), call MyClass.GetAxis("Vertical") and then determine what to return based on whatever you want for the current platform (analog sticks, physical buttons, mouse, on-screen touch controls etc.).
     
  4. mikewarren

    mikewarren

    Joined:
    Apr 21, 2014
    Posts:
    109
    FWIW, I assumed this post referred to the new input system, but on a closer read, it doesn't say so specifically.
     
  5. flipwon

    flipwon

    Joined:
    Dec 29, 2016
    Posts:
    179
    I was referring to the new input system, but I was unable to find the inputs he was referring to within the device I was searching. It's fine though, I've since moved on from the new input system.