Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to find joystick buttons in Unity Input? [SOLVED]

Discussion in 'Getting Started' started by Jesse_DuBord, Feb 10, 2017.

  1. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
    I'm trying to program certain behaviors for a Saitek Cyborg Graphite Joystick (https://www.amazon.com/Saitek-Cyborg-Graphite-Joystick-USB/dp/B000F2HGU0/ref=sr_1_fkmr1_1?ie=UTF8&qid=1486760005&sr=8-1-fkmr1&keywords=saitek+cyborg+graphics).

    There are a series of buttons at the top that I would like to utilize. Using the InputManager, it appears that I need to know the specific ID or name of each button in order to utilize it.

    How can I find out the necessary name/identifier/etc. for each button in order to use it?

    Thanks in advance!

    EDIT: I got to the point where I could do some trial and error with using "joystick 1 button 0", "joystick 1 button 2", etc. in the input fields. However, the knob at the top of the joystick doesn't seem to register with either joystick axes or buttons. How can I map the 4-direction knob at the top of this joystick?
     
    Last edited: Feb 10, 2017
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    You could brute force it. Put a loop in Update that goes through all of the key codes and logs the ones that are pressed. Then you can read the appropriate keys off the console.

    Unity's input system is pretty archaic. The other option is to purchase an asset like Rewired that should do the job for you.
     
  3. Bill_Martini

    Bill_Martini

    Joined:
    Apr 19, 2016
    Posts:
    445
    Try visiting their web site. You can download drivers, configuration software, manuals, and they also have a support link.
    Go here http://www.saitek.com. It's always good to try the manufacture first.
     
  4. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
    @BoredMormon, thanks for the idea. I can't say I'm proficient enough in C# to code something like that at the moment (kinda learning as I go along).

    @Bill_Martini, thanks for the suggestion, but looks like Saitek doesn't have a manual for their Cyborg Graphite mode. Just my luck, right?

    I took another route, opened Elite Dangerous (space exploration game) and tried inputting the knobs at the top in the control mapping menu to see if it would give me any clues. The actual buttons show as "JOY-1" or "JOY-2", but the knob at the top shows as "JOY-POV-UP" or "JOY-POV-LEFT". So I'm wondering if they aren't being recognized as buttons.

    Has anyone encountered this similar behavior with joysticks? I can't tell if this means they're behaving like buttons or axes...
     
  5. Jesse_DuBord

    Jesse_DuBord

    Joined:
    Jan 15, 2017
    Posts:
    60
    Looks like I was able to find another forum post that had the answer (https://forum.unity3d.com/threads/joystick-hats.42795/). The "hat" at the top of the joystick is an 8-way input that registers as the 4th and 5th axes for the corresponding joystick (in the case of the Saitek Cyborg Graphite model). Setting the input type as "Joystick Axis" and setting the Axis to "4th axis (Joysticks)" got me the results I was looking for. Thanks all, hope this helps others looking for similar answers.
     
    athenspire likes this.
  6. ico170

    ico170

    Joined:
    Apr 10, 2014
    Posts:
    3
    ikbeniernie and SmartCarrion like this.
  7. ikbeniernie

    ikbeniernie

    Joined:
    Mar 30, 2021
    Posts:
    2
    Thank you ico170! That asset you posted helped me out in my own project (with Playstation2 Buzz controllers)