Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Mouse axis not working

Discussion in 'Linux Editor' started by WildMageGames, Aug 26, 2015.

  1. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    183
    Hi,

    I have installed the package on Xubuntu 14.04. My project can be loaded and launched on Linux. Great work, I am happy to see it happen.

    However, mouse axis (Input.GetAxis("Mouse X") etc.) do not work. For instance in the MouseLook script in the FirstPersonController asset.
    Mouse buttons are working.
    The mouse is also working for the UI.

    On a new project, the following script attached to the main camera display always values equal to zero.
    Code (CSharp):
    1.  
    2. void Update () {
    3.     Debug.Log("Input mouse X " + Input.GetAxis("Mouse X"));
    4.     Debug.Log("Input mouse Y " + Input.GetAxis("Mouse Y"));
    5. }
     
  2. Stoopers

    Stoopers

    Joined:
    Feb 25, 2015
    Posts:
    17
    i get this problem too, can't get mouse axis to rotate camera,.
     
  3. amarok-blue

    amarok-blue

    Joined:
    Jun 17, 2014
    Posts:
    78
  4. Voresh

    Voresh

    Joined:
    Mar 7, 2015
    Posts:
    2
    The same problem on Ubuntu 14.04.3
     
  5. Cirmik

    Cirmik

    Joined:
    Jan 8, 2014
    Posts:
    6
    Same on Ubuntu 15.04.
    It works when I unfocus the game window, like clicking somewhere else in the editor. It should be the other way around.
     
  6. Stoopers

    Stoopers

    Joined:
    Feb 25, 2015
    Posts:
    17
    but, when you Build the game, Mouse Axis will working normaly,.
     
  7. WildMageGames

    WildMageGames

    Joined:
    Mar 24, 2014
    Posts:
    183
    Hi,
    Further details about this bug, after some experimentations:

    In the editor:
    - launch the game : get axis does not work
    - click somewhere else in the editor
    - put the mouse over the game windows: get axis work (only when the mouse stay over the windows), but the keyboard does not.
    - click again to focus the game window: mouse does not work, keyboard does.

    Moreover, CursorLockMode.Locked never work.

    As said Stoopers, the mouse works correctly when the game is Built.

    It is probably a bug in the input events dispatcher in the editor.
     
  8. Tak

    Tak

    Unity Technologies

    Joined:
    Mar 8, 2010
    Posts:
    974
    We'll investigate - thanks!
     
  9. dehen_

    dehen_

    Joined:
    Sep 30, 2012
    Posts:
    8
    My experience matches a.emilien's. CursorLockMode.Locked doesn't work, and my getaxis works the same way with the mouse focus.

    Manjaro/Gnome3
     
  10. jeraldamo

    jeraldamo

    Joined:
    Jun 24, 2015
    Posts:
    1
    Same experience as Cirmik...
     
  11. Nirvana33

    Nirvana33

    Joined:
    Oct 29, 2012
    Posts:
    2
    Same.. Mouse never gets locked or invisible. Also camera doesn't look at mouse

    elementary OS Freya
     
    Last edited: Aug 29, 2015
  12. Zuntatos

    Zuntatos

    Joined:
    Nov 18, 2012
    Posts:
    531
    Same. prevents testing any fps-like game in editor
     
  13. bobbaluba

    bobbaluba

    Joined:
    Feb 27, 2013
    Posts:
    18
    I have the same issue on Arch with Gnome, please let me know if there's anything I can do to help.

    Is there anybody who do not have this issue?
     
  14. cacek

    cacek

    Joined:
    Jul 12, 2015
    Posts:
    3
    I have the same problem.
    Slackware, KDE 5, xorg-1.16.4, gtk 2.24.27
     
  15. dhiru1602

    dhiru1602

    Joined:
    Jun 28, 2015
    Posts:
    4
  16. lolstorm

    lolstorm

    Joined:
    Jun 27, 2014
    Posts:
    1
    I have the same problem.
    Linux Debian 3.16.0-4-amd64, KDE 4.14.2
     
  17. oceanarts

    oceanarts

    Joined:
    Sep 4, 2015
    Posts:
    3
    Same issue. Ubuntu Mate 14.04.
     
  18. kgbayala528

    kgbayala528

    Joined:
    Feb 6, 2015
    Posts:
    1
    Same issue. Linux Mint 17.2
     
    WarWeasle likes this.
  19. Zuntatos

    Zuntatos

    Joined:
    Nov 18, 2012
    Posts:
    531
    Issue seems partially fixed for me on manjaro. GetAxis works - but choppy like it's not updated every frame. Anyone can confirm this for other distro's (especially ubuntu based ones)?
     
  20. Fra123X

    Fra123X

    Joined:
    Mar 10, 2013
    Posts:
    40
    I can confirm. It kinda works but not perfectly. Also, Input.GetMouseButton (0) never returns true.
     
  21. Sabun

    Sabun

    Joined:
    Nov 13, 2012
    Posts:
    12
    Just to report back here, the latest version of Unity 5.1.0f3+2015091501 seems to fix the mouse issues.

    Confirmed to work on Ubuntu 15.04 64bit (running a build of the project):
    1. FirstPersonController rotating works
    2. Using Input.GetMouseButton(0) works
    3. Hiding cursor with Cursor.visible = false works
    4. Using Cursor.lockState = CursorLockMode.Locked works

    The mouse in the editor when running the project is a bit weird though. For some odd reason, as soon as I drag the mouse into the Game window of the Editor it will always default to looking up at the sky (Vector3.up direction?).
     
    amarok-blue likes this.
  22. thojoh370

    thojoh370

    Joined:
    Sep 8, 2012
    Posts:
    2
    This is still an issue to me in 5.1.0f3, Ubuntu 14.04 LTS.

    Input.GetAxis has no effect in the game while focused, but if I click somewhere outside the game like the Inspector, both X and Y work fine. As expected though, since the game is no longer in focus, key input is disabled.

    Keyboard input works as expected when focused but mouse does not, so my guess would be an inverted focus toggle for Input.GetAxis somewhere in Unity? Presumably one toggling whether mouse activity should be registered or not. I went to the issue tracker for this but it's marked as resolved...
     
  23. LukaKotar

    LukaKotar

    Joined:
    Sep 25, 2011
    Posts:
    385
    Are you certain you are running the latest build? It was fixed in "build #2015090301". It still feels very buggy when the cursor is locked, but you can download the latest build at the bottom of this thread: Unity on Linux: Release Notes and Known Issues
     
  24. thojoh370

    thojoh370

    Joined:
    Sep 8, 2012
    Posts:
    2
    Oh guess I wasn't, probably just assumed the main Linux download would be the latest build, heh. Makes more sense the more I think about it. It's still behaving strangely indeed, but at least I can look around now!

    Thanks for the pointer!
     
  25. ElNamano

    ElNamano

    Joined:
    Mar 21, 2016
    Posts:
    1
    This is still a problem for me. Running the 5.4 Beta on Ubuntu GNOME 15.10, mouse axis are choppy and unresponsive in the editor and will stop responding if my cursor leaves the window when compiled (even though mouse is locked and not visible).
     
  26. Zuntatos

    Zuntatos

    Joined:
    Nov 18, 2012
    Posts:
    531
  27. sara_conagher

    sara_conagher

    Joined:
    Jul 9, 2015
    Posts:
    8
    Hi, I have a problem with reading the mouse position on Kubuntu 17.04 (x86-64; KDE 5.9) while it's in full screen mode. As you can see on the screenshot I've attached, the input from Input.GetAxis("Mouse X") and Input.GetAxis("Mouse Y") is working as expected, but values of Input.mousePosition.x.ToString() and Input.mousePosition.y.ToString() are bizarre. I'm working on Unity 5.6.2p1.
    The same happened with compositing disabled for KWin, and Openbox as the window manager. The problem DOES NOT OCCUR when windowed.
     

    Attached Files:

  28. Tak

    Tak

    Unity Technologies

    Joined:
    Mar 8, 2010
    Posts:
    974
    @tora_chan: it sounds like you're experiencing this issue, which is fixed in 5.6.2p3 and 2017.1f3 (there's also a hotfix build for 5.6.2f1 linked in the thread).
     
  29. sara_conagher

    sara_conagher

    Joined:
    Jul 9, 2015
    Posts:
    8
    Thank yo for the reply. It is indeed fixed. It is working as it should on Unity 5.6.2f3 :)
     
  30. dwadruller_unity

    dwadruller_unity

    Joined:
    Feb 10, 2018
    Posts:
    1
    Still have the issue on the newest version,
    Arch linux, i3
     
  31. andrews_unity

    andrews_unity

    Unity Technologies

    Joined:
    Dec 11, 2015
    Posts:
    150
    We don't support Arch, I have seen weird mouse issues when running on Arch, does this happen in a supported distro such as ubuntu ?
     
unityunity