Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

xbox 360 controller

Discussion in 'Scripting' started by iamthwee, May 23, 2016.

  1. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Hi boys,

    Is there a standard way to use the xbox 360 controller with unity's first person controller script.

    My problems.

    I've hooked it up to my mac mini but the mouse look doesn't work unless I got into the project menu settings and change the input controls to this.(I've installed the mac driver and it recognises it fine)

    http://wiki.unity3d.com/index.php?title=Xbox360Controller

    When I adjust the settings to read from the joypad the mouse controls don't work anymore.

    Or is the FPS controller designed to only work on windows?
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    If you set up two axis with the same name then Unity will read both of them fine.
     
  3. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Thanks can you give an example? I managed to map most of the buttons but the mouse look, i.e the right stick only works on the joypad not the mouse move.


    I also have some other questions regarding standard inputs for xbox controller playstation controllers etc, will they all accept different codes?

    I appreciate the code will be different for different operating systems and that is not an issue as you only target one OS at a time. But you could have an xbox controller or playstation controller or something else on your mac.
     
  4. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Anyone know? This is kinda bugging me, I'm sure I'm doing something stupid.
     
  5. RavenOfCode

    RavenOfCode

    Joined:
    Apr 5, 2015
    Posts:
    869
    Add this as another Input, keep the other Mouse X too (for mouse), do the same for Mouse Y. You may need to change the axis's as I am using a ps2 controller so this works for my analog sticks.
    Mouse X.png
     
    iamthwee likes this.
  6. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Thanks, I didn't realise you could duplicate the Mouse X and Mouse Y. What a dummy I am. That indeed solved it...

    But the other question I had was how does one know in advance if it will work for any joypad, xbox one, xbox 360, playstation etc?
     
  7. RavenOfCode

    RavenOfCode

    Joined:
    Apr 5, 2015
    Posts:
    869
    It lets the play choose Input at startup.
    InputAtStartup.png
     
  8. skalev

    skalev

    Joined:
    Feb 16, 2012
    Posts:
    264
    You don't and it won't. That XBOX 360 config will work for XBOX360. Other joy pads can be an issue with Unity.

    In our project that is for PS4 & PC, and requires a gamepad, we used Rewired.

    https://www.assetstore.unity3d.com/en/#!/content/21676

    I'm extremely happy with the package, and would recommend it to anyone.
     
  9. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149
    Yeah I'd rather not do the choose input thing at startup, also does that even work with the joypad? Also I'd rather not shell out on any paid assets.

    So basically, what you're saying is I'm pretty much screwed when it comes to different joypads?
     
  10. RavenOfCode

    RavenOfCode

    Joined:
    Apr 5, 2015
    Posts:
    869
    Most people with none 360 controllers use an emulator such as x360ce.
     
  11. iamthwee

    iamthwee

    Joined:
    Nov 27, 2015
    Posts:
    2,149