Basically im curious can I program a Unity game for windows to use a 360 controller? What about a web player game using a 360 controller…
Unity should recognise it if you plug it in so long as windows does (not sure how well 360 controllers work with Macs). If you plug in your 360 controller (wired works best) and get windows to see it fine under Game Controllers, you should have no problems using it in a Unity Game. Make sure you use Input.GetAxis and Input.GetButton rather than Keys, and check your Project>Input Settings for default button assignments to the joystick.
Two additional points: although the 360 controller works as-is on Vista and later, you will need to get a driver for XP to see it, much like the PS3 SixAxis does.
Thats what I figured.just needed to be sure. I’ll give it a shot… I want to develop a game and a 360 controller or PC controller would work best but the keyboard will also be usable
OK good luck!
I reported a bug with the triggers on the X360 controller in 2009 when Shawn, one of the Unity developers told me it was a bug, and I should report it. Last time I checked was May this year, and it still hadn’t been fixed. Long story short, it works but you cannot differentiate between the left and right triggers - which made it useless for me, but might be alright for other purposes.
Incidentally, my bug report was thrown out because it was “too old” and might have been fixed without someone closing the ticket, I guess I should re-file the bug report but it’s been raised on the forums numerous times since without anything happening, so I guess it’s not a priority.
Not true. I have set up the 360 controller just fine (including triggers) with the use of this guide from the wiki :-
You should check it in the latest versions as I know that there was a fix for ‘connecting new controllers while unity is running’. Originally unity only enumerated the devices on startup and never again.
Just in case of the triggers though: Unity uses DirectInput not XInput and MS decided to fuckup the trigger handling on DInput with their drivers for the X360 controller, potentially to enforce XInput or just cause they were funny.
On DInput the triggers act as a single, connected axis instead of two distinct ones. L will go from 0 to -1, R 0 to 1, when both are pressed that gives you a flat 0
Consequence is also that you can not get the ‘full pressed’ as a button state cause it simply is none
To overcome this multiple persons created XInput plugins for unity, primarily to get the 360 controller work right or get force feedback
thanks for the link