Search Issue Tracker
Duplicate
Votes
5
Found in
2018.3.0a7
2018.3.8f1
Issue ID
1135106
Regression
Yes
[iOS] [MFI Controller] Input.GetButtonDown fires multiple times when holding down a button
Reproduction steps:
1. Connect a gamepad controller to an iOS device.
2. Open the attached "1135106.zip (17.4 KB)" project.
3. Build and run the "New Scene" to an iOS device.
4. Hold the "A" button and check the Xcode Console.
Actual behavior:
- Input.GetButtonDown is continuously returning True when the button is being held (number counts from 1 and increments by 1 (1, 2, 3, etc)) (Screenshot attached).
Expected behavior:
- Only 1 click is triggered on each button press.
Reproduced with:
iOS: 2018.3.0a8, 2019.2.0a7
HORIPAD ULTIMATE
iPhone 8+ iOS 11.0, iPhone 6S iOS 12.1.2
Not reproducible with:
iOS: 2017.4.0f1, 2018.2.21f1, 2018.3.0a6
or
Android
Regression introduced in:
2018.3.0a7 (Build doesn't work on iOS) or 2018.3.0a8
Note:
The duplicate case was reproduced with GetKey, GetKeyDown, and GetKeyUp. Both cases are regressions, so this is most likely caused by the same root issue.
-
Resolution Note (2018.3.10f1):
Comments (6)
-
Ash_Bash
Mar 13, 2020 12:31
The duplicate issue mentioned is NOT a duplicate of this, as the fix in the other issue only applies to tvOS devices, not iOS devices.
Problem still exists for iOS devices ever since Unity 2018.3, upto and including 2019.3.5f1.
Looking into iPhone_Sensors.mm in the generated Xcode project, the problem is related to the use of NSMutableSet* pressedButtons, which on each update in ResetAggregatedJoystickState() via UnityUpdateJoystickData() resets the button state of all buttons that were previously pressed) - therefore this will continuously keep refiring ButtonDown and ButtonUp for any button held down since each pressed button is getting forcibly reset again each time per update.
The problem was "fixed" for tvOS by removing that collection's use when compiling for tvOS (by using a preprocessor define). If you do a similar change for iOS by just removing all use of pressedButtons altogether, then ButtonDown and ButtonUp appear to exhibit the correct behaviour on iOS once again.
I'm quite honestly amazed the problem is still present in the latest stable 2019 release of Unity. One can only hope that someone will actually fix this proper in a future release.
-
BaronBoese
Jul 16, 2019 20:26
Same here! Apple TV 4th gen, Steelseries stratus xl, as well as the Siri Remote. Unity 2018.3.11f
-
paulrts
Jul 11, 2019 14:49
We're experience a similar issue; selected UI buttons are being clicked repeatedly when holding a gamepad button to 'submit' via standalone input module.
-
JustMars
Jun 29, 2019 21:58
I am still having this problem on Unity 2019.1.7, using Steelseries Nimbus controller with iPad Air 2. Would really like to get this fixed as fast as possible.
-
Nickjd331
May 19, 2019 18:19
I'm having the same problem. Have spent weeks trying to fix it.
Does anyone have a workaround.
I'm also seeing the right stick returning duplicate values of the left stick which I cannot remove.
-
TomekLKE
Apr 30, 2019 09:17
I have similar problem with Siri Remote on apple TV 4th gen. I map the touch area click (joystick 14) and play pause button (joystick 15) they call Input.GetButtonDown every frame it completely breaks my game. Any info from Unity ?
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Shadows are not present when using unity_SpriteColor and Alpha Clipping in Shader Graph
- [macOS] Secondary display rendering incorrect target and flickering when building for Multi-Display
- "Create Empty Child" Option Creates Root Object When No Parent Is Selected
- Freeze/Crash when entering Play Mode in a specific project
- Lack of documentation regarding VFX Ray Tracing support
This is a duplicate of issue #1143342