Search Unity

Bug Mouse position flickers in Editor fullscreen on non-primary monitor

Discussion in 'UGUI & TextMesh Pro' started by cecarlsen, Oct 31, 2022.

  1. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    864
    So, in-Editor fullscreen was recently added which is great. But apparently it comes with some birth defects. I am not sure this is just a uGUI specific issue, but the example project I made use uGUI.

    I have filed a bug report with case IN-21628. Unity 2022.2.20f1.

    An example package is attached.

    1. What happened
    Mouse position is unreliable in Editor fullscreen on non-primary monitor. It jumps from the actual position to what looks like x2 position on my monitors. I have only tested on Windows.

    2. How can we reproduce it using the example you attached
    • Set primary monitor to 4K (3840x2160) and a secondary monitor to something else like 2K (1920x1080) in Windows settings.
    • Import the attached package in a fresh 2022.1.20f project and open the scene 'EditorFullscreenBug'.
    • Drag the game view to the second monitor and set 'Enter Play Mode' to fullscreen on the second monitor.
    • Hit play and hover the second monitor.
    • A pink square should flicker between two positions.

    The square is positioned like this (but I get the same problem when using for example ICanvasRaycastFilter).
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3.  
    4. public class CustomImage : Image
    5. {
    6.     void Update()
    7.     {
    8.         rectTransform.position = Input.mousePosition;
    9.     }
    10. }
     

    Attached Files:

    Last edited: Oct 31, 2022
  2. Mayumichi

    Mayumichi

    Joined:
    Mar 12, 2017
    Posts:
    31
    I don't think it's uGUI specific, just hit this bug when doing camera raycasts. Seems to be the input systems (both new and old) reporting wrong mouse coordinates when the mouse moves.