Search Unity

InputSystemUIInputModule, mouse and virtual cursor

Discussion in 'Input System' started by io-games, Oct 9, 2019.

  1. io-games

    io-games

    Joined:
    Jun 2, 2016
    Posts:
    104
    I'm trying to make virtal cursor.
    I wrote my custom device to provide position and bind it to "UI/Point", it works fine, cursor moves = ui reacts on hover. But click does not work, because it comes from mouse device.

    Events can come only from only one device in same time, right?
    Also I checked InputSystemUIInputModule, it seems it has hardcoded mouse related code (not sure about it).

    Please, show me the way to make virtual cursor (for gamepad).
     
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Binding "UI/Click" to e.g. the gamepad A button should do the trick.

    It has what it calls a "mouse model" to serve UI pointer events from but the source input data for it is not locked to mouse input. Click counts are mouse-only ATM (as they don't come in through bindings; something that should be fixed IMO) but clicks aren't.
     
  3. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Just for reference, 1.0.0-preview.5 will come with an example for how to set up a gamepad mouse cursor which also contains a reusable component that does most of the work.
     
  4. io-games

    io-games

    Joined:
    Jun 2, 2016
    Posts:
    104
    great, but after 2 weeks of trying to make it works on nintendo switch, I returned to legacy.
    Maybe will try again in 2020 ;)
     
  5. emptyxu

    emptyxu

    Joined:
    Jun 15, 2017
    Posts:
    12
    the example is totally broken in build