Hi, I am using Unity for a class and trying to make an MFI controller work with my phone. I set it up in the inputs menu, but it seems that the app I make does not detect the controller, even though other games do just fine (Even one unity game I got from the app store).
Is there an extra step I should do, beyond mapping the buttons in the input menu? A separate mapping works just fine for windows/android with a controller.
Since youâre already familiar with the process for win/android there isnât anything extra that needs to happen for IOS. Just the entries in the input manager for the axis and the relevant code. The joystick buttons and axis are different for most platforms though so it might be worth running my free utility from the asset store to make sure that you are actually checking the right entries on IOS.
Okay then, any idea why it isnât working? Ive tried it with two different MFI compatible controllers (Moga rebel and Mad Catz CTRLI). The left stick isnât even working despite it being the same on all controllers, and I found a log command to output connected controllers- 0. Is this some bug with current version of unity? I have the latest Xcode, and latest unity (Updated both when this first happened). Its driving me a bit nuts.
I havenât built that test for iOS, which I would need to do to test it. However given that unity itself reports that there are 0 controllers connected, I donât think it would work at all.
This isnât a mapping issue its a detection issue, it simply ignores that I connect a controller to my phone
I can test the script on my device in like an hour if you think it will make a significant difference.
You are correct that if the call to getjoysticknames() returns no results that it wonât make a difference, I missed that you said Unity reports no controllers connected.
If you discover that the current version of Unity doesnât work but a previous one does with the same code, certainly submit a bug report.
I never had a chance to try older versions of unity, so I donât k now if they work. I was just kind of hoping I was missing something simple, rather than it apparently being a bug. Can anyone with an iPhone and MFI check if they can make an app work with current versions of everything? Thanks.
EDIT: I tried building that scene you recommended in a new project just to be sure. No luck.
I donât have either of these controllers, but Iâve tried connecting Steelseries Stratus and Horipad ultimate gamepads that I have to an app built with 5.3.2f1 and they seems to be working fine. All the MFi controllers should work the same with Unity as far as Iâm aware, so this might be a bug on our side.
But it would make sense to make sure that the controller is actually detected by iOS with Game Controller | Apple Developer Documentation (or you could just try some non Unity game on the AppStore that has game pad support ; D). And if you can get the controller to work with other apps please submit a bug report and post the bug id here.
Yes, I believe you are correct in that they should all work the same. I tried some non unity games and even a unity game from the app store and they worked fine with the controller (Sonic CD, which I play as well as something called âSword of Rapierâ which is built with unity and uses an MFI controller). I even tried with the following process: test other game(works) switch to mine(No) switch back without doing anything else(Still works).
I will submit a bug report when I have time tomorrow then, but I would like to ask: What version of Xcode are you using? I just tried updating mine to the latest and it did not help.
very strange then. I am on Xcode 7.2, with Unity 5.3.2f1 (Freshly installed). Mac 10.11.2(Going to probably update this tonight). Ive removed Unity and Xcode as near to fully as I can, both to try to solve this and also clear some space (Xcode was taking 30 gigs of old simulators)
All in all it seems to be the ideal environment to try to test it in. On build settings I have Xcode running as release with the other options unchecked.
Does all that match your settings?
After that I just hit build and run. The app clearly works, but no controller is detected.
I think we actually found what could be causing this. Itâs necessary to add the GameController or the GameKit framework in Xcode in Xcode for the controllers to actually be detected by the app. Unity doesnât currently do that automatically and I couldnât reproduce this with my project because it was using Game Center which also references the GameKit api.
Weâve already fixed this and this fix should be included in the next path release, but you can just fix this manually by adding âGameController.frameworkâ to the linked frameworks list in your projectâs settings in Xcode.
That is exactly what the problem was, thank you. You may want to put some kind of notice on the page for MFI controllers until then, it caused me and some of my classmates a lot of stress (I am in a Virtual Reality class, and we used Unity for our first project. Its of us in different groups spent hours debugging on this issue, since many of us had iPhones)
Hi Paulius, I wanted to note one other thing I found. It seems the documentation you have here: http://docs.unity3d.com/Manual/iphone-joystick.html
Is not right, at least anymore. I loaded up the app that Gregg recommended earlier to test inputs, and it doesnât match what you have.
For example, right trigger is button 11 but axis 12. Pretty much every item on that list is wrong on either the button or axis side, except the sticks.
In the past I have noted that as well especially during the TVOS beta. The most common documentation error is the higher number axis tend to be off by one lower than they should be. From a developer perspective I believe the documentation accidentally represents the enum used internally by Unity. The enum for the Axis is like the following:
Axis 1 = 0;
Axis 2 = 1;
Axis 3 = 2;
ctdâŚ
I think when making the documentation this gets mixed up quite easily. The buttons on the other hand in the keycode enum are very high numbers and arenât mixed up as easily.
Iâm using 2017.2, and GameController.framework is still not included automatically in my app. I had to dig up this thread and add the framework manually before I could access MFi inputs in my game.
EDIT: And whatâs worse, I have to do this on every build, even when just using âAppendâ (rather than âReplaceâ) mode. Unity, please fix this!
Hello,
I am using Unity 2018.3.0f2 for my project. After add GameController.framework, my game running on iphone still cannot detect the controller. Although system setting shows that my controller is connected, my game cannot detect the controller at all. No controller names are returned from the API Input.GetJoystickNames(). Do anybody have some ideas?