Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411283 Posts in 69325 Topics- by 58380 Members - Latest Member: bob1029

March 29, 2024, 07:28:33 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)[Solved] Xbox One controller support via xinput in Unity?
Pages: [1]
Print
Author Topic: [Solved] Xbox One controller support via xinput in Unity?  (Read 5050 times)
Shadowspaz
Level 1
*



View Profile WWW
« on: March 15, 2015, 07:44:04 PM »

I've been working with a group on a simple 2D fighting game in Unity, and for controller support, rather than use Unity's own detection (Which doesn't seem to be able to differentiate between triggers), I opted for xinput. So with a bit of searching I found this c# wrapper (XInputDotNet), which has worked pretty nicely for me so far.

One of my friends in this group, though, only has an Xbox One controller with which to test the game out, and his Y button is registering as LB, and his right analog has no input at all. I sent him the sample script that came with XInputDotNet, which shows the input values for all buttons and axis of the connected controller, and I'm just waiting for him to get back from work so that we can start figuring out some solution.

Now, there's no way this issue hasn't come up before. With both Unity and the Xbox One rising in use, I'm sure someone must have a solution to this. Anyone have any advice?
« Last Edit: March 18, 2015, 04:35:04 PM by Shadowspaz » Logged

Check out my devlog!
Sik
Level 10
*****


View Profile WWW
« Reply #1 on: March 16, 2015, 06:00:37 PM »

Wait, Unity doesn't support XInput at all by default? (the two triggers coming up as the same axis implies those controllers are running in DirectInput mode)

That said, I was under the impression that XBox One controllers also used XInput (albeit a newer variant). Maybe I'm wrong?
Logged
Shadowspaz
Level 1
*



View Profile WWW
« Reply #2 on: March 17, 2015, 02:07:09 PM »

Seems like you're just as confused about this as I am. lol

Correct, Unity does not support XInput by default. Maybe that's different in Unity 5 now, but I haven't updated yet. I was also thinking that XBox One controllers worked with XInput, but from the bit of research I did, it seems that (At least interfacing with Windows) it uses Windows.Xbox.Input, rather than XInput. I could be misinterpreting something there, but the fact remains that when my friend presses his 'Y' button, Controller.Buttons.LeftShoulder returns true. So something's amiss.
Logged

Check out my devlog!
Shadowspaz
Level 1
*



View Profile WWW
« Reply #3 on: March 18, 2015, 04:06:31 PM »

Huh... Well, nevermind this, then. After a bit of testing, everything seems to work just fine. So I'm not sure if something really weird happened, or if I just got some bad information from the guy, or what.

But yeah. Xbox One works fine with XInput. lol
« Last Edit: March 18, 2015, 04:35:21 PM by Shadowspaz » Logged

Check out my devlog!
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic