Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

How to get Input for Left, Right, Up, Down on Ps4/Xbox Controller?

Discussion in '2D' started by hereder, May 17, 2019.

  1. hereder

    hereder

    Joined:
    Apr 28, 2017
    Posts:
    136
    I have a mini game where you have to press X, O, Traingle and Square on the controller in order to open a door. But its sooo messy to write a script that suits both Xbox and Ps4 controllers so i thought I would
    replace the buttons with directions, Left, Right, Up, Down...
    How do I access these direction in script?

    Code (csharp):
    1.  
    2.  if (Input.GetButtonDown("Fire1") || Input.GetButtonDown("Fire2") || Input.GetButtonDown("Fire3") || Input.GetButtonDown("Fire4") && miniGame.activeSelf)
    3.  
    This is the current button assignments :S
    Tahnsk in advnace!
     
  2. anubhav01

    anubhav01

    Joined:
    Feb 20, 2018
    Posts:
    3
  3. hereder

    hereder

    Joined:
    Apr 28, 2017
    Posts:
    136