Search Unity

8 way stick and dpad buttons

Discussion in 'Input System' started by colinday, Feb 2, 2020.

  1. colinday

    colinday

    Joined:
    Jan 9, 2012
    Posts:
    25
    Built into the StickControl and DpadControl are nice easy to use "virtual buttons" for the directions
    up, right, down, left

    A really common use case for many games is to have 8 way buttons, it would be convenient if this was built into those input controls so that we had:
    up, up right, right, down right, down, down left, left, up left

    What's the recommended way to achieve this within the new input system framework?
     
    Last edited: Feb 2, 2020
  2. colinday

    colinday

    Joined:
    Jan 9, 2012
    Posts:
    25
    For what it's worth in case anybody else is looking for information on this, I ended up going directly to the Gamepad StickControl and DpadControl and wrote a 8 way button state states for released, releasedThisFrame, pressed, pressedThisFrame.

    My only sticking point is knowing that the control is back in the dead zone as I'm not sure what the "proper" way is to detect that given the control with an arbitrary set of processors on it, but since I don't use any but the default on it already I could hack around that by checking against the settings in InputSystem.settings.*