Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd45fba4

Browse files
FIX: InputSystem documentation fix for android (#2281)
Co-authored-by: Anthony Yakovlev <anthony.yakovlev@gmail.com>
1 parent0d23da5 commitd45fba4

File tree

2 files changed

+47
-37
lines changed

2 files changed

+47
-37
lines changed

‎Packages/com.unity.inputsystem/CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ however, it has to be formatted properly to pass verification tests.
1616

1717
###Fixed
1818
- An issue where a UITK MouseEvent was triggered when changing from Scene View to Game View in the Editor has been fixed.[ISXB-1671](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1671)
19+
- Fix documentation error in file AndroidGameController.cs mentioning a wrong controller.[DOCATT-9806]
20+
1921

2022
##[1.16.0] - 2025-11-10
2123

‎Packages/com.unity.inputsystem/InputSystem/Plugins/Android/AndroidGameController.cs‎

Lines changed: 45 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -140,47 +140,55 @@ public override string ToString()
140140

141141
namespaceUnityEngine.InputSystem.Android
142142
{
143-
////FIXME: This is messy! Clean up!
144143
/// <summary>
145-
///Gamepadon Android. Comprises all types of gamepads supported on Android.
144+
///Represents a gamepad deviceon Android, providing unified support for various controller types.
146145
/// </summary>
147146
/// <remarks>
148-
///Most of thegamepads:
147+
///This layout covers multiple Android-supportedgamepads, including but not limited to:
149148
/// - ELAN PLAYSTATION(R)3 Controller
150-
/// - My-Power CO.,LTD. PS(R) Controller Adaptor
151-
/// (Following tested and work with: Nvidia Shield TV (OS 9); Galaxy Note 20 Ultra (OS 11); Galaxy S9+ (OS 10.0))
152-
/// - Sony Interactive Entertainment Wireless (PS4 DualShock) (Also tested and DOES NOT WORK with Galaxy S9 (OS 8.0); Galaxy S8 (OS 7.0); Xiaomi Mi Note2 (OS 8.0))
153-
/// - Xbox Wireless Controller (Xbox One) (Also tested and works on Samsung Galaxy S8 (OS 7.0); Xiaomi Mi Note2 (OS 8.0))
149+
/// - My-Power CO., LTD. PS(R) Controller Adaptor
150+
/// - Sony Interactive Entertainment Wireless (PS4 DualShock)
151+
/// - Xbox Wireless Controller (Xbox One)
154152
/// - NVIDIA Controller v01.03/v01.04
155-
/// - (Add more)
156-
/// map buttons in the following way:
157-
/// Left Stick -> AXIS_X(0) / AXIS_Y(1)
158-
/// Right Stick -> AXIS_Z (11) / AXIS_RZ(14)
159-
/// Right Thumb -> KEYCODE_BUTTON_THUMBR(107)
160-
/// Left Thumb -> KEYCODE_BUTTON_THUMBL(106)
161-
/// L1 (Left shoulder) -> KEYCODE_BUTTON_L1(102)
162-
/// R1 (Right shoulder) -> KEYCODE_BUTTON_R1(103)
163-
/// L2 (Left trigger) -> AXIS_BRAKE(23)
164-
/// R2 (Right trigger) -> AXIS_GAS(22)
165-
/// X -> KEYCODE_BUTTON_X(99)
166-
/// Y -> KEYCODE_BUTTON_Y(100)
167-
/// B -> KEYCODE_BUTTON_B(97)
168-
/// A -> KEYCODE_BUTTON_A(96)
169-
/// DPAD -> AXIS_HAT_X(15),AXIS_HAT_Y(16) or KEYCODE_DPAD_LEFT(21), KEYCODE_DPAD_RIGHT(22), KEYCODE_DPAD_UP(19), KEYCODE_DPAD_DOWN(20),
170-
/// Note: On Nvidia Shield Console, L2/R2 additionally invoke key events for AXIS_LTRIGGER, AXIS_RTRIGGER (in addition to AXIS_BRAKE, AXIS_GAS)
171-
/// If you connect gamepad to a phone for L2/R2 only AXIS_BRAKE/AXIS_GAS come. AXIS_LTRIGGER, AXIS_RTRIGGER are not invoked.
172-
/// That's why we map triggers only to AXIS_BRAKE/AXIS_GAS
173-
/// Nvidia Shield also reports KEYCODE_BACK instead of KEYCODE_BUTTON_SELECT, so Options(XboxOne Controller)/View(DualShock)/Select buttons do not work
174-
/// PS4 controller is officially supported from Android 10 and higher (https://playstation.com/en-us/support/hardware/ps4-pair-dualshock-4-wireless-with-sony-xperia-and-android)
175-
/// However, some devices with older OS have fixed PS4 controller support on their drivers this leads to following situation:
176-
/// Some gamepads on Android devices (with same Android number version) might have different mappings
177-
/// For ex., Dualshock, on NVidia Shield Console (OS 8.0) all buttons correctly map according to rules in AndroidGameControllerState
178-
/// when clicking left shoulder it will go to AndroidKeyCode.ButtonL1, rightShoulder -> AndroidKeyCode.ButtonR1, etc
179-
/// But, on Samsung Galaxy S9 (OS 8.0), the mapping is different (Same for Xiaomi Mi Note2 (OS 8.0), Samsung Galaxy S8 (OS 7.0))
180-
/// when clicking left shoulder it will go to AndroidKeyCode.ButtonY, rightShoulder -> AndroidKeyCode.ButtonZ, etc
181-
/// So even though Android version is 8.0 in both cases, Dualshock will only correctly work on NVidia Shield Console
182-
/// It's obvious that this depends on the driver and not Android OS, thus we can only assume Samsung in this case doesn't properly support Dualshock in their drivers
183-
/// While we can do custom mapping for Samsung, we can never now when will they try to update the driver for Dualshock or some other gamepad
153+
/// - (More may be added later)
154+
///
155+
/// ### Typical Android Axis and Key Mappings
156+
/// | Control | Mapping |
157+
/// |------------------------|----------------------------------------------------|
158+
/// | Left Stick | AXIS_X(0) / AXIS_Y(1) |
159+
/// | Right Stick | AXIS_Z(11) / AXIS_RZ(14) |
160+
/// | L1 | KEYCODE_BUTTON_L1(102) |
161+
/// | R1 | KEYCODE_BUTTON_R1(103) |
162+
/// | L2 | AXIS_BRAKE(23) |
163+
/// | R2 | AXIS_GAS(22) |
164+
/// | Left Thumb | KEYCODE_BUTTON_THUMBL(106) |
165+
/// | Right Thumb | KEYCODE_BUTTON_THUMBR(107) |
166+
/// | X | KEYCODE_BUTTON_X(99) |
167+
/// | Y | KEYCODE_BUTTON_Y(100) |
168+
/// | B | KEYCODE_BUTTON_B(97) |
169+
/// | A | KEYCODE_BUTTON_A(96) |
170+
/// | DPAD | AXIS_HAT_X(15), AXIS_HAT_Y(16) or KEYCODE_DPAD_* |
171+
///
172+
/// ### Notes
173+
/// - **NVIDIA Shield Console**
174+
/// - The L2 and R2 triggers generate both `AXIS_BRAKE` / `AXIS_GAS` and `AXIS_LTRIGGER` / `AXIS_RTRIGGER` events.
175+
/// - On most Android phones, only `AXIS_BRAKE` and `AXIS_GAS` are reported; `AXIS_LTRIGGER` and `AXIS_RTRIGGER` are not invoked.
176+
/// - For consistency across devices, triggers are mapped exclusively to `AXIS_BRAKE` and `AXIS_GAS`.
177+
/// - The Shield also reports `KEYCODE_BACK` instead of `KEYCODE_BUTTON_SELECT`, causing the **Options** (Xbox), **View** (DualShock), or **Select** buttons to be non-functional.
178+
///
179+
/// - **PS4 Controller Compatibility**
180+
/// - Official PS4 controller support is available starting from **Android 10 and later**
181+
/// (see: https://playstation.com/en-us/support/hardware/ps4-pair-dualshock-4-wireless-with-sony-xperia-and-android).
182+
/// - On older Android versions, driver implementations vary by manufacturer. Some vendors have partially fixed DualShock support in custom drivers, leading to inconsistent mappings.
183+
///
184+
/// - **Driver-Dependent Behavior**
185+
/// - Gamepad mappings may differ even between devices running the *same Android version*.
186+
/// - For example, on **Android 8.0**:
187+
/// - **NVIDIA Shield Console:** buttons map correctly according to `AndroidGameControllerState` (for example, `L1 → ButtonL1`, `R1 → ButtonR1`).
188+
/// - **Samsung Galaxy S9 / S8** and **Xiaomi Mi Note2:** mappings are inconsistent (for example, `L1 → ButtonY`, `R1 → ButtonZ`).
189+
/// - These discrepancies stem from device-specific **driver differences**, not the Android OS itself.
190+
///
191+
/// Because mapping inconsistencies depend on vendor-specific drivers, it’s impractical to maintain per-device remaps.
184192
/// </remarks>
185193
[InputControlLayout(stateType=typeof(AndroidGameControllerState),variants=AndroidGameControllerState.Variants.Gamepad)]
186194
publicclassAndroidGamepad:Gamepad
@@ -223,7 +231,7 @@ public class DualShock4GamepadAndroid : DualShockGamepad
223231
}
224232

225233
/// <summary>
226-
///A PlayStation DualShock 4 controller connected to an Android device.
234+
///An XboxOne controller connected to an Android device.
227235
/// </summary>
228236
[InputControlLayout(stateType=typeof(AndroidGameControllerState),displayName="Android Xbox One Controller",
229237
variants=AndroidGameControllerState.Variants.Gamepad+InputControlLayout.VariantSeparator+AndroidGameControllerState.Variants.DPadAxes)]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp