Search Unity

Bug Cannot interact with UI on second display with new Input System

Discussion in 'Input System' started by garthreilly, Sep 1, 2022.

  1. garthreilly

    garthreilly

    Joined:
    Dec 13, 2021
    Posts:
    9
    I've just created a very default scene with a canvas and a button on it. Then I added another camera, and another canvas with a button on it, and set that to target Display 2.

    I can interact with the buttons while in the Editor. I.e. I select Display 1, and I can interact with the button on that display, and then I can select Display 2, and I can interact with the button on that display.

    However, when I build the application and run it, I see both displays with their own button on, but I cannot interact with the button on the 2nd display.

    I've tried this on 2021.3.0f1 and 2021.3.8f1 without success.

    It did work on 2020.3.32f1
     
    szamilMST likes this.
  2. Olivier-Tache

    Olivier-Tache

    Joined:
    Feb 27, 2015
    Posts:
    21
    Hi, we have the same issue here (on 2021.3.13f1), have you found a solution since your post ?
     
  3. garthreilly

    garthreilly

    Joined:
    Dec 13, 2021
    Posts:
    9
    Hi. Apologies for the slow response. No, I haven't, so I did log it as a bug with Unity. They have since reviewed it and confirmed it as being a bug: IN-17801.

    To date, it hasn't been resolved.
     
  4. magnusfox

    magnusfox

    Joined:
    Nov 7, 2014
    Posts:
    26
    I have the same problem in 2022.2.16. I've unsuccessfully tried to find the bug report you mentioned, do you have a link to it by any chance?
     
  5. garthreilly

    garthreilly

    Joined:
    Dec 13, 2021
    Posts:
    9
  6. magnusfox

    magnusfox

    Joined:
    Nov 7, 2014
    Posts:
    26
  7. garthreilly

    garthreilly

    Joined:
    Dec 13, 2021
    Posts:
    9
    We didn't. We've been forced to stay on Unity 2020.3 because of it. The one workaround is to migrate back to the old input system, but there were a few issues there. Off the top of my head, particularly w.r.t touch input and Unity's UI system. Just an update though, as of recently, this bug has now been logged with Unity's Technical Support from an Enterprise User so, fingers crossed, it should get resolved shortly.
     
  8. magnusfox

    magnusfox

    Joined:
    Nov 7, 2014
    Posts:
    26
    Thanks for the update! I can confirm that it works as expected in the last beta version (2023.1.0b14), hopefully the fix can trickle down to the more stable versions as well soon enough.
     
  9. garthreilly

    garthreilly

    Joined:
    Dec 13, 2021
    Posts:
    9
    Aaah, thanks for that feedback. That is great to know!
     
    magnusfox likes this.
  10. andorfy

    andorfy

    Joined:
    Oct 12, 2015
    Posts:
    24
    Hi everybody, I run into this issue with a VR project. I tested with the 2023.1.0b16 editor version, and the UI on the second screen only works if the headset (Quest 2 via Link) is not connected to the PC. As soon as I start the build with the hedaset connected, the UI can't register any event. I only need a button and a scroll view but I can't interact any of them.

    Is there any idea or workaround for this?
     
  11. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    945
    I have a similar issue, using VR. OpenXR depends on the new input system, which means it's not possible to switch to the old input manager as workaround.
    Are there other possible workarounds?
     
  12. garthreilly

    garthreilly

    Joined:
    Dec 13, 2021
    Posts:
    9
    I have received recent feedback from Unity that the bug is still not fixed, but there is a possible workaround that they're going to try test out. I'll post the solution if it does work out and they forward the workaround to me.
     
    Flavelius likes this.
  13. garthreilly

    garthreilly

    Joined:
    Dec 13, 2021
    Posts:
    9
    Same answer as to andorfy: I have received recent feedback from Unity that the bug is still not fixed, but there is a possible workaround that they're going to try test out. I'll post the solution if it does work out and they forward the workaround to me.
     
  14. garthreilly

    garthreilly

    Joined:
    Dec 13, 2021
    Posts:
    9
    @andorfy @Flavelius @magnusfox @Olivier-Tache :

    Finally have a workaround, received from Unity. I've done it myself and it works in both Unity 2021.3.26f1 & 2022.3.1f1.

    The workaround requires replacing the Graphic Raycaster component in every Canvas with the CustomGraphicRaycaster.cs script (attached). This script is using the display index information that is now returned in the last version of the New Input Package, so, the project also requires to be in the last version of the New Input System.

    NB! The New Input System MUST be v1.6.1 (or higher in the future I assume).
     

    Attached Files:

    jbertra, magnusfox and Flavelius like this.
  15. magnusfox

    magnusfox

    Joined:
    Nov 7, 2014
    Posts:
    26
    Good news! The problem is not present in the latest LTS (2022.3.2f0).
     
    Last edited: Jun 22, 2023
    Flavelius and garthreilly like this.
  16. garthreilly

    garthreilly

    Joined:
    Dec 13, 2021
    Posts:
    9
    Great! Will upgrade my Unity Editor soon then to this...
     
  17. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    945
    The issue is still present in 2022.3.8f1 (input system package 1.6.3), but the custom raycaster above indeed functions as a workaround for now. Thanks
     
    Last edited: Aug 29, 2023
  18. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    945
    And to update, the custom raycaster only works in editor, but not in build (22.3.8f1), so it's still very much an issue.
    Test setup has 2 displays, same resolution or different resolution doesn't seem to make a difference.
     
  19. Tommaso_Rosi

    Tommaso_Rosi

    Joined:
    Apr 18, 2018
    Posts:
    2
    Hi, does anyone have any update? It's a huge problem for our project
     
  20. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    945
    it still doesn't work in the latest versions
     
  21. BlazeMaster

    BlazeMaster

    Unity Technologies

    Joined:
    Sep 26, 2022
    Posts:
    2
    the fix should now be in 2022.3.21f1 .. give it a try ..
     
    Flavelius likes this.
  22. knobby67

    knobby67

    Joined:
    Aug 30, 2015
    Posts:
    389
    Does this work on Linux? In Unity hub I can select 2022.3.22f1 and 2023.2.15f1

    If it’s fixed in Linux can I use one of these two?
     
  23. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    945
    It really seems to work now. Finally, thanks!
     
  24. knobby67

    knobby67

    Joined:
    Aug 30, 2015
    Posts:
    389
    Doesn't work on Linux. Using 2023.2.15f1 does have a different result to the older 2021, 2021 showed presses on screen 1 as buttons pressed on screen 2, if you hit the corresponding position. However 2023.2.15f1 hitting screen 1 has not effect on screen 2.
    I've also added the new CustomGraphicRaycaster.cs but no luck.

    Can anyone advise? Thanks
     
  25. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    945
    There's still an issue when using VR worldspace canvas input. There seems to be code that uses
    Display.activeEditorGameViewTarget to (in this case incorrectly) set the display value which then cancels out the VR-Canvas raycaster logic depending on where the PC-Cursor last clicked. VR input uses a controller-attached invisible camera as event source, which seems to be the common way to do this (it worked in the past, pre 2022 (2 displays, PC+VR input)). Now this PC-display filtering interferes with the VR worldspace canvas input.
    A partial workaround is to force the invisible vr interaction camera's targetdisplay & the eventdata's targetdisplay value to the one of the current pc cursor's display. This makes it atleast work in builds.
     
    Last edited: Apr 15, 2024