Search Unity

Cursor not crossing screen boundary like it would in windows.

Discussion in 'Linux' started by moar55, Dec 13, 2018.

  1. moar55

    moar55

    Joined:
    Mar 30, 2016
    Posts:
    1
    Hi. When I am using the editor controlling values of parameters or I am doing any activity that would require me to drag the cursor till the edge of the screen I become restricted by the edge of the screen unlike in windows where the cursor would cross the screen edge and continue from the other side of the screen. Why is this issue happening in Linux and is there a fix?
    I am using Unity 2018.216f1 and running Ubuntu 18.04.1
    Thanks in advance
     
  2. djoledjole2

    djoledjole2

    Joined:
    Nov 5, 2016
    Posts:
    5
    I have the same problem on Kubuntu 18.10 and Unity 2018.3 and 2019.1
     
  3. HZ51

    HZ51

    Joined:
    Jul 28, 2016
    Posts:
    42
  4. djoledjole2

    djoledjole2

    Joined:
    Nov 5, 2016
    Posts:
    5
    No my problem is exactly the same like the post above mine, cursor is limited to screen, it is supposed to pass through screen edge and show up on opposite side of screen like it normally does on windows when you do certain stuff, even in game play mode its limited to screen edges, so for example i can't rotate camera in full circle due to that. I do also have similar problem like in the link you posted where my cursor is flipped horizontally all the time in when inside Unity Linux editor but i didnt mind that as much as the screen edge limitation
     
  5. PixelJ

    PixelJ

    Unity Technologies

    Joined:
    Nov 1, 2018
    Posts:
    216
  6. djoledjole2

    djoledjole2

    Joined:
    Nov 5, 2016
    Posts:
    5
  7. unity_gD1Ah1NC1tU0fw

    unity_gD1Ah1NC1tU0fw

    Joined:
    Dec 30, 2020
    Posts:
    2
    The bug still exists in Unity 2019.4.17f1 on Kubuntu 20.04.1 LTS after 2 YEARS LATER.
     
    predo likes this.
  8. KevinWelton

    KevinWelton

    Joined:
    Jul 26, 2018
    Posts:
    239
    This is an issue with the limitations of X. We have plans to address this in the future so all 3 platforms behave in a similar manner. We want to get away from the Windows behavior and do something more like the macOS behavior. Having the cursor go out one side and in the other side reminds me of playing old Atari games.

    So hang tight. My team doesn't have the resources to fix this right now, but it is on our radar.
     
    wilman_d and djoledjole2 like this.
  9. Daniel-Talis

    Daniel-Talis

    Joined:
    Dec 10, 2011
    Posts:
    425
    Waiting for this fix, am using Linux Mint 20.1 Cinnamon. Unity 2020.3.7f1
    This is a major bug, how can Unity advertise the editor as being Linux compatible with such a problem?
     
    Last edited: Jul 26, 2021
    predo likes this.
  10. sam_salorio

    sam_salorio

    Joined:
    Nov 4, 2021
    Posts:
    1
    This sort of behavior is also somewhat related to trying to use Unity inside a Remote Desktop window - in Edit Mode the mouse jumps to the other side of the screen and you can pan infinitely, but in Play Mode I can only look so far before the mouse hits the edges of the RDP window (even when fullscreen), and doesn't go any further. Is there any way to get the same behavior in Play Mode as Edit Mode?
     
  11. Daniel-Talis

    Daniel-Talis

    Joined:
    Dec 10, 2011
    Posts:
    425

    Still hanging on tight.
     
  12. KevinWelton

    KevinWelton

    Joined:
    Jul 26, 2018
    Posts:
    239
    This is fixed in 2022.1. The backport to 2021.2 is still open.

    I've verified this in Ubuntu 18.04, 20.04 and 21.10 when using X11. When using Ubuntu 21.10 with Wayland there is buggy behavior.

    If anyone sees this on an install of Ubuntu LTS builds or CentOS 7 running X11 where this isn't working, please let us know.
     
    rbits0 and Daniel-Talis like this.
  13. Mem0Real

    Mem0Real

    Joined:
    Nov 28, 2021
    Posts:
    1
    Hello, i am using X11 and the problem still persists. The mouse can pan infinitely to the left side but not on the right side. I am using ubuntu 20.04 and unity 2020.3.31f.
    Thank you in advance.
     
  14. Addeman

    Addeman

    Joined:
    Oct 20, 2020
    Posts:
    5
    How come you want to move away from this behavior? This enables me to feel unlocked from the boundaries of the screen, making my workspace feel larger, and makes it easier to do precision work on values, and especially as I'm a big user of the "Alt + right click"-zoom editor-feature, as it enables me to zoom in and out from a selected object. I recently got a new job where I got a mac book to work on, an environment I have never worked with, but I never thought that these kinds of small features would differ such between the two largest OS:s there are..

    I guess I will just have to wait for the fix in the 2022.1 version to reach LTS and then for my company to make the jump onto that version in a few years.. simply gotta get comfy without it /-_-\
     
  15. Daniel-Talis

    Daniel-Talis

    Joined:
    Dec 10, 2011
    Posts:
    425
    I found a workaround for this. I have the cursor placed at the centre of the screen where it stays while the mouse can pan across the edges of the screen. 360 degrees actually. Works a charm. I'll post the code if you are interested.
     
    Addeman likes this.
  16. Addeman

    Addeman

    Joined:
    Oct 20, 2020
    Posts:
    5
    Oh yes please! :D So it's an Editor-tool solution?
     
  17. Daniel-Talis

    Daniel-Talis

    Joined:
    Dec 10, 2011
    Posts:
    425
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class MouseStateGameLoad : MonoBehaviour {
    6.  
    7.     void Start()
    8.     {
    9.  
    10.         Cursor.lockState = CursorLockMode.Locked;
    11.         Cursor.visible = false;
    12.     }
    13.  
    14.     void OnApplicationFocus(bool ApplicationIsBack)
    15.     {
    16.         if (ApplicationIsBack == true)
    17.         {
    18.             Cursor.lockState = CursorLockMode.Locked;
    19.             Cursor.visible = false;
    20.         }
    21.     }
    22.  
    23. }
    Ok, so this locks the cursor to the centre of the screen. Works when you run a 3D program in the editor and also in a compiled program. Make a C# file out of the above code and put it in your program. If necessary I can post an example.
     
    Addeman likes this.
  18. Addeman

    Addeman

    Joined:
    Oct 20, 2020
    Posts:
    5
    Great thanks! I don't think I'll need an example, this is pretty straight-forward :thumbs-up:

    I'm currently working in the 2019.2.21f1-version, and here this issue doesn't exist - zooming with Option-button + Right Mouse Button and dragging works just like it does in Windows, so it has worked fine on MacOS before!
     
  19. Addeman

    Addeman

    Joined:
    Oct 20, 2020
    Posts:
    5
    Must mention that the zoom-feature is working now for me, since I updated to the currently latest LTS version (2021.3.11f1). The reason it didn't work might be as you said due to some limitations, but in my case it can also be because I was on the 2021.2.10 INTEL version even though I'm on a M1 Pro and should use the SILICON version, which I was unable to do, for buggy reasons not worth getting into here. As I've understood, the usage of an INTEL version of Unity for MacOS on a SILICON (M1 Pro) hardware isn't efficient at all, which I really noticed now when I finally got to update to the newest LTS and thus SILICON-version of Unity - such a difference in speed! :D
     
  20. wilman_d

    wilman_d

    Joined:
    Jul 24, 2016
    Posts:
    6
    Tried this on Unity 2022.1.23f1. the cursor still have weird behaviour(bug still there). the cursor does go out one side and in the other side. but the viewport didn't rotated seamlessly. when the cursor go out on another side, the viewport view jumping to random direction, like skipping some degrees. the same happened with zooming out, when the cursor go to the edge and go out on another side, the zoom out was not continue seamlessly instead going back to the place before zooming out.

    Maybe you can take an example from Blender or even Autodesk Maya for linux to fix this? they did a good job on this one.

    Thanks anyway.