Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Getting additional buttons from joystick not using InputActions

Discussion in 'Input System' started by Tech-Labs, Feb 7, 2024.

  1. Tech-Labs

    Tech-Labs

    Joined:
    Feb 5, 2014
    Posts:
    106
    I want a bare bones C# script to check my joystick's other (not the 'trigger') buttons. And I only need to check a specific button and no need for player input or such, just reading a button. I did make a version using InputActions and that works fine, but is not what I was looking for.

    I've got a game controller that Unity identifies as Joystick. When looking in the Input Debugger I see all the buttons (about 10), sticks, etc. So Unity seems to understand just fine.

    Now I want to use the Joystick.current to read buttons, but Joystick.current only has <trigger> as a property not the other buttons.
    Is there a way to read all the buttons and sticks without using InputActions but by using the Joystick.current command?

    Thanks!