Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Handling mouse input in UWP game

Discussion in 'Windows' started by Wishade, Dec 9, 2020.

  1. Wishade

    Wishade

    Joined:
    Nov 10, 2019
    Posts:
    1
    Hello all.
    I am developing an UWP game for the Xbox platform.
    When trying to implement a new feature, a keyboard and mouse supporting I am completely stuck with mouse input.
    All input in the game handles by Rewired input system.
    I have configured and mapped input devices - Xbox controller works on Xbox One and standalone platforms, mouse and keyboard are enabled on standalone and etc.
    When I tried to implement keyboard/mouse input on Xbox I found out that keyboard input handles properly, but mouse never appears.
    Unity version is 2018.4.16
    Build type is D3D project.
    I downloaded and compile UWP mouse input sample to check how it works: https://github.com/Microsoft/Xbox-ATG-Samples
    It sounds ridiculous but I can't use mouse in that project. It works on Dev Home on console, cursor moves, but if I load sample - mouse not appear, I can see only two green buttons and can't press them.
    Then I tried to use UWP documentation and write simple class to test.
    I used Windows.Devices.Input namespace. Create instance of MouseCapabilities class and check mousePresent property in Awake and Update.
    It always returns 0, no matter if i start application with connected mouse or connect it when game runs.

    I want to get physical mouse input on Xbox game.
    Could someone explain is there some point in mouse/game configuration that I miss?
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,646
    I was under impression mouse input wasn't supported in games on Xbox One (although I don't own a retail console so I might just not know about it).
     
  3. timke

    timke

    Joined:
    Nov 30, 2017
    Posts:
    407
    According to this Microsoft support forum, mouse input isn't available on Xbox One for UWP apps.

    The official Xbox support page seems to confirm this:
    I understand this to mean: you've got to have a special partnership with Microsoft to have mouse support in your Xbox One app.
     
  4. DanP142

    DanP142

    Joined:
    Oct 8, 2022
    Posts:
    1
  5. timke

    timke

    Joined:
    Nov 30, 2017
    Posts:
    407
    Mouse input is generally not allowed on Xbox UWP except for specific apps that Microsoft has individually approved. Here's an updated link to Microsoft's new Q/A forums addressing this problem.

    From MSFT poster: