Skip to content

NEW: Support Xbox controllers over USB using native macOS support [ISXB-1547] #2179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

vallerieknight-unity
Copy link
Member

@vallerieknight-unity vallerieknight-unity commented May 7, 2025

Description

Adds Xbox controller support back on macOS, now using macOS's new(ish) native support for Xbox controllers, rather than requiring usage of a 3rd party driver.

Testing status & QA

  • New device in use, so no impact to existing cases where a user is successfully using the older controller support
  • Added tests to cover new devices; tests green on local machine (currently running in Yamato)

Overall Product Risks

_Please rate the potential complexity and halo effect from low to high for the reviewers. Note down potential risks to specific Editor branches

  • Complexity: Low: The only real difficulty was the change in bit mapping, and that we no longer need to invert axis
  • Halo Effect: Low: This is a new device, and the description we get from macOS is unique such that it won't clash with our existing mappings

Comments to reviewers

Checklist

Before review:

  • [ X ] Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • JIRA ticket linked, example (case %%). If it is a private issue, just add the case ID without a link.
    • Jira port for the next release set as "Resolved".
  • [ X ] Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration tests.
  • [ X ] Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

After merge:

  • Create forward/backward port if needed. If you are blocked from creating a forward port now please add a task to ISX-1444.

@vallerieknight-unity
Copy link
Member Author

(running formatter locally now :) )

@ekcoh ekcoh requested a review from Pauliusd01 May 22, 2025 11:08
@Pauliusd01
Copy link
Collaborator

Did not forget this one, will try to review it today/tomorrow

Copy link
Collaborator

@Pauliusd01 Pauliusd01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, checked that the controller is recognised and works correctly both in bluetooth/wired modes in Playmode, Player and the Input debugger. Also, double checked that nothing broke with the other controllers as well.

@codecov-github-com
Copy link

codecov-github-com bot commented Jun 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

@@           Coverage Diff            @@
##           develop    #2179   +/-   ##
========================================
  Coverage    67.80%   67.81%           
========================================
  Files          367      367           
  Lines        53505    53513    +8     
========================================
+ Hits         36280    36288    +8     
  Misses       17225    17225           
Flag Coverage Δ
mac_2021.3_pkg 5.41% <0.00%> (-0.01%) ⬇️
mac_2021.3_project 70.42% <100.00%> (+<0.01%) ⬆️
mac_2022.3_pkg 5.19% <0.00%> (-0.01%) ⬇️
mac_2022.3_project 65.29% <100.00%> (+<0.01%) ⬆️
mac_6000.0_pkg 5.20% <0.00%> (+<0.01%) ⬆️
mac_6000.0_project 67.73% <100.00%> (+2.35%) ⬆️
mac_6000.1_pkg 5.20% <0.00%> (-0.01%) ⬇️
mac_6000.1_project 67.71% <100.00%> (+<0.01%) ⬆️
mac_6000.2_pkg 5.20% <0.00%> (-0.01%) ⬇️
mac_6000.2_project 67.71% <100.00%> (+<0.01%) ⬆️
mac_trunk_pkg 5.20% <0.00%> (-0.01%) ⬇️
mac_trunk_project 67.71% <100.00%> (+<0.01%) ⬆️
win_2021.3_pkg 5.42% <ø> (ø)
win_2021.3_project 70.49% <ø> (ø)
win_2022.3_pkg 5.20% <ø> (ø)
win_2022.3_project 65.37% <ø> (ø)
win_6000.0_pkg 5.20% <ø> (ø)
win_6000.0_project 67.78% <ø> (+0.10%) ⬆️
win_6000.1_pkg 5.20% <ø> (ø)
win_6000.1_project 67.78% <ø> (-0.01%) ⬇️
win_6000.2_pkg 5.20% <ø> (ø)
win_6000.2_project 67.68% <ø> (-0.11%) ⬇️
win_trunk_pkg 5.20% <ø> (ø)
win_trunk_project 67.79% <ø> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...system/InputSystem/Plugins/XInput/XInputSupport.cs 100.00% <100.00%> (ø)
...tem/InputSystem/Plugins/XInput/XboxGamepadMacOS.cs 73.68% <100.00%> (+5.94%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vallerieknight-unity
Copy link
Member Author

@Pauliusd01 thanks for the review! would you be able to hit the Merge button? I don't seem to have access...

@Pauliusd01
Copy link
Collaborator

@vallerieknight-unity Gave you access, should be able to merge now. But lets wait for a dev review as well @jfreire-unity

@vallerieknight-unity
Copy link
Member Author

Oops! Missed that second review was still yellow...

Copy link
Collaborator

@jfreire-unity jfreire-unity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding this, and I apologize for taking so long to approve it.
Meanwhile, I did try to test improvements to our Xbox situation on macOS, but I still did not have time to finish it. It's better to merge this now and remove our device state boilerplate later.

@vallerieknight-unity
Copy link
Member Author

no worries, nothing to apologize for :) I'm on holiday for the next few days but will merge when I get back

@jfreire-unity
Copy link
Collaborator

@vallerieknight-unity I can probably merge once CI passes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants