Search Unity

Problems with Remote Desktop?

Discussion in 'Input System' started by kayy, Jan 9, 2020.

  1. kayy

    kayy

    Joined:
    Jul 26, 2011
    Posts:
    110
    I started integrating the WebRTC package including new input system last months on a PC at the the customer site. Now I wanted to continue via remote desktop and ran into problems with mouse UI input when working remote.
    The problem occurs in Unity editor and when using the Windows build. If I copy the same exe on my local PC, it works as expected. Mouse shows up in Input Debug view and events are fired. Even more confusing: Remote Input (similar to RemoteInput.cs from UnityRenderStreaming) works fine.

    Are there any known issues?
    I am using the stable branches of InputSystem, WebRTC and some code from UnityRenderStreaming on Unity 2019.1.12. Player settings / Active Input Handling is configured to use both but this does not affect the outcome. If I switching back to legacy input by using StandAloneInputModule the app works again without problems, but this won't work for web streaming.
    BTW: The UnityRenderSteaming sample project (modified) shows the same effects.
     
  2. vidard

    vidard

    Joined:
    Nov 1, 2018
    Posts:
    3
    Have this problem in editor too when trying my games over remote desktop it does not respond to input on anything using the new input system
     
    kayy likes this.
  3. kayy

    kayy

    Joined:
    Jul 26, 2011
    Posts:
    110
    I found out that some parts of the input like for example click and mouse button down are detected and processed, but the mouse position is always (0; 0). If a button stays at tthe bottom left corner, it receives the click event.

    Even more strange: I saw that the mouse position is set correctly when I scroll using the mouse wheel. Then the mouse position stays on this position until the scroll wheel is active again at another position. Combining both scrolling and moving seems to work as well.
    In my tests I connected a Mac to a Windows 10 host with MS Remote Desktop and Jump Desktop. Another test from Windows 10 to Windows 10 showed the same behaviour. Thus the RDP client is not to blame.
     
  4. CPlusSharp22

    CPlusSharp22

    Joined:
    Dec 1, 2012
    Posts:
    111
    I have this problem too! I can't use 2019.3f builds in remote desktop :(
    In editor works fine for me, but anything built doesnt response to mouse. Keyboard works fine
     
  5. CPlusSharp22

    CPlusSharp22

    Joined:
    Dec 1, 2012
    Posts:
    111
    Setup Autohotkey

    Here's the script, you press F8 and it clicks like the hardware mouse. I can finally "use" my UI....

    Code (JavaScript):
    1. F8::
    2.     While GetKeyState("F8", "P"){
    3.         Click
    4.         Sleep 50 ;  milliseconds
    5.     }
    6. return
     
  6. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Mouse problems on Windows with RDP connections is a known issue.

    My guess is it's coming from the fact we switched entirely to RawInput for mouse input. The old input system has mixed mouse event handling where part of mouse input is picked up from WM_ messages and part of it is picked up through RawInput. At least that's my explanation so far but we haven't yet dug deeper into it. It's on the list but may or may not happen for 1.0.
     
  7. kayy

    kayy

    Joined:
    Jul 26, 2011
    Posts:
    110
    Thanks for your reply. I currently have implemented a somewaht hacky workaround by using both input systems in parallel. While any streaming client is active I switch to the new input system and have event listener polling for a predefined hotkey of the local Keyboard to switch back to legacy input system.
    Anyway it would be cool if this were fixed one day.
     
  8. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    We have a (native-side) fix in the landing pattern. It's making its way through the pipes and is expected to hit 2019.3 and 2020.1.

    Turns out the problem actually was that we only responded to relative mouse input from RawInput whereas with RDP connections, you get absolute mouse input. Easy fix.
     
    karl_jones and kayy like this.
  9. misun1191

    misun1191

    Joined:
    Jan 17, 2015
    Posts:
    4
    Is this fixed in 2019.3? I had a problem with mouse (virtual/absolute input) when I use remote desktop (Mac, remote desktop client: AnyDesk, NoMachine) access in 2018.1, 2019.1 and I just downloaded 2019.3 and I face the same problem. My problem is that when I try to move the objects in Scene View or Inspector by dragging the mouse (in Editor), nothing happens. Neither I can rotate/pan the scene view camera because mouse input is not recognised. Mouse click is fine, it is just the delta of mouse input that are not recognised... (known issue for several years without solution)
     
    NestorAlgieri likes this.
  10. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    What version of 2019.3 do you have? The fix is in 2019.3.6f1
     
  11. misun1191

    misun1191

    Joined:
    Jan 17, 2015
    Posts:
    4
    Unfortunately,I face the same problem both in 2019.3.6f1 and 2019.3.5f1... it's installed on Mac Mojave 10.14.6 and I am connecting it via NoMachine. I don't think it's the problem of remote client (same problem with AnyDesk)
     
  12. misun1191

    misun1191

    Joined:
    Jan 17, 2015
    Posts:
    4
    Is there any way of rotating the scene view camera with keyboards or script (that doesn't require Mouse delta)? Panning can be done with arrow key, but I can't find a way to orbit the scene view..
     
  13. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    I dont think the fix will work for you here. It was a fix for Windows only. Could you file a bug report so we can investigate this please?
     
  14. RobertVerdes

    RobertVerdes

    Joined:
    Nov 27, 2015
    Posts:
    6
    I can confirm I am facing the same issues: mouse not responding inside the scene view, in Unity 2019.3.7f1 installation on OSX Catalina, over a TeamViewer connection from a Windows machine

    Is there an issue set up so I can upvote?
     
    NestorAlgieri likes this.
  15. Iron-Warrior

    Iron-Warrior

    Joined:
    Nov 3, 2009
    Posts:
    838
    Having an issue that seems related, but unfortunately is being difficult to reproduce. After upgrading, I'm noticing that when using Parsec or Steam Remote Play Together, the mouse does not behave correctly. I'll have to take a video next time, but it sort of looks like the mouse position is being reported incorrectly.

    We did not have this issue until we updated our project from 2019.1.2f1 to 2019.3.6f1, and the InputSystem from preview-3 to preview-6. Did that fix ever make it through @Rene-Damm? Just wondering if there's anything we can do, since my team is using Remote Play Together/Parsec to test during Covid stuff.

    I'll post an update when it happens again.
     
  16. hdose

    hdose

    Joined:
    Apr 6, 2020
    Posts:
    2
    I'm using Win10 over RDC and still no mouse rotation on Unity 2019.3.8f1.
     
  17. sinaari

    sinaari

    Joined:
    Jan 28, 2019
    Posts:
    47
    Connecting with RDP from Windows 10 (where I build the game) to an AWS NVIDIA Gaming PC g4 instance running Windows Server 2019 where I have to run the game, still no mouse rotation, Unity 2019.3.8f1, standard Windows RDP client.
     
  18. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    What do you mean by mouse rotation?
    We detect the mouse cursor when in RDP. Are you referring to the mouse wheel?

    Please file a bug report so we can investigate.
     
  19. sinaari

    sinaari

    Joined:
    Jan 28, 2019
    Posts:
    47
    Oh, I apologize, I did not say exactly what am I doing, but it's simple: I am unable to rotate the camera with the FreeCamera.cs script on it. The FreeCamera script comes from the "Core RP Library" package, and I'm using the latest version of it (version 7.3.1). Probably I could implement a workaround with custom input, like people are suggesting here, but the default script provided by Unity for rotating the camera does not work. But since the issue is said to be already fixed, I am not sure how this can be happening?

    I can file a bug report a bit later, if needed.
     
  20. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    Does it work when you use it locally? I suspect it's an issue with the script.
     
  21. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Note that the FreeCamera script in the Core RP package still uses the old input system. Does it work when you switch "Active Input Handling" in the player preferences to "Both"?
     
    karl_jones likes this.
  22. sinaari

    sinaari

    Joined:
    Jan 28, 2019
    Posts:
    47
    Yes, it does work OK locally, both inside the editor and the build. However, when I am launching the build on the remote machine, right mouse click rotation is unavailable. The script comes from Unity with the Core RP Library package, it's not mine.

    Just tried that, but no, it does not change anything. It was set for "Input Manager (Old)", and I've set it to "Both", created a new build and tested it. The result is the same: right mouse-click rotation does not work.

    Note: I am able to get it to work partially by adding additional mouse-tracking code to FreeCamera.cs that is provided by Serjiok in https://forum.unity.com/threads/right-click-mouse-not-work-on-a-remote-desktop.417324/ but the movement is a bit sluggish and each time I right-click and rotate, the camera angle resets to the original one and I the rotation starts from it's original orientation. Probably it can be fixed in the code, I did not yet modify what Serjiok provided, but if tracking the mouse is actually possible, and was working even with the "Input Manager (Old)" setting, then why FreeCamera.cs from Core RP Library is not using a working solution?

    The full code of my changed FreeCamera, with the code additions from Serjiok, the only new code is the `PostUpdate()` method:

    Code (CSharp):
    1. using System.Collections.Generic;
    2.  
    3. namespace UnityEngine.Rendering {
    4.     public class FreeCameraRDP : MonoBehaviour {
    5.         [SerializeField] bool isRdpFixEnabled = false;
    6.         /// <summary>
    7.         /// Rotation speed when using a controller.
    8.         /// </summary>
    9.         public float m_LookSpeedController = 120f;
    10.         /// <summary>
    11.         /// Rotation speed when using the mouse.
    12.         /// </summary>
    13.         public float m_LookSpeedMouse = 10.0f;
    14.         /// <summary>
    15.         /// Movement speed.
    16.         /// </summary>
    17.         public float m_MoveSpeed = 10.0f;
    18.         /// <summary>
    19.         /// Value added to the speed when incrementing.
    20.         /// </summary>
    21.         public float m_MoveSpeedIncrement = 2.5f;
    22.         /// <summary>
    23.         /// Scale factor of the turbo mode.
    24.         /// </summary>
    25.         public float m_Turbo = 10.0f;
    26.  
    27.         private static string kMouseX = "Mouse X";
    28.         private static string kMouseY = "Mouse Y";
    29.         private static string kRightStickX = "Controller Right Stick X";
    30.         private static string kRightStickY = "Controller Right Stick Y";
    31.         private static string kVertical = "Vertical";
    32.         private static string kHorizontal = "Horizontal";
    33.  
    34.         private static string kYAxis = "YAxis";
    35.         private static string kSpeedAxis = "Speed Axis";
    36.  
    37.         Vector2 lastAxis;
    38.         float x = 0;
    39.         float y = 0;
    40.         float xSpeed = 0;
    41.         float ySpeed = 0;
    42.        
    43.         void OnEnable() {
    44.             xSpeed = ySpeed = m_LookSpeedMouse;
    45.             RegisterInputs();
    46.             lastAxis = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
    47.         }
    48.  
    49.         void RegisterInputs()
    50.         {
    51. #if UNITY_EDITOR
    52.             List<InputManagerEntry> inputEntries = new List<InputManagerEntry>();
    53.  
    54.             // Add new bindings
    55.             inputEntries.Add(new InputManagerEntry { name = kRightStickX, kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Fourth, sensitivity = 1.0f, gravity = 1.0f, deadZone = 0.2f });
    56.             inputEntries.Add(new InputManagerEntry { name = kRightStickY, kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Fifth, sensitivity = 1.0f, gravity = 1.0f, deadZone = 0.2f, invert = true });
    57.  
    58.             inputEntries.Add(new InputManagerEntry { name = kYAxis, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "page up", altBtnPositive = "joystick button 5", btnNegative = "page down", altBtnNegative = "joystick button 4", gravity = 1000.0f, deadZone = 0.001f, sensitivity = 1000.0f });
    59.  
    60.             inputEntries.Add(new InputManagerEntry { name = kSpeedAxis, kind = InputManagerEntry.Kind.KeyOrButton, btnPositive = "home", btnNegative = "end", gravity = 1000.0f, deadZone = 0.001f, sensitivity = 1000.0f });
    61.             inputEntries.Add(new InputManagerEntry { name = kSpeedAxis, kind = InputManagerEntry.Kind.Axis, axis = InputManagerEntry.Axis.Seventh, gravity = 1000.0f, deadZone = 0.001f, sensitivity = 1000.0f });
    62.  
    63.             InputRegistering.RegisterInputs(inputEntries);
    64. #endif
    65.         }
    66.  
    67.         void Update()
    68.         {
    69.             // If the debug menu is running, we don't want to conflict with its inputs.
    70.             if (DebugManager.instance.displayRuntimeUI)
    71.                 return;
    72.  
    73.             float inputRotateAxisX = 0.0f;
    74.             float inputRotateAxisY = 0.0f;
    75.             if (Input.GetMouseButton(1))
    76.             {
    77.                 //lastAxis = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
    78.                 //.Log($"MOUSE POSITION: x = {Input.mousePosition.x}, y = {Input.mousePosition.y}");
    79.                 inputRotateAxisX = Input.GetAxis(kMouseX) * m_LookSpeedMouse;
    80.                 inputRotateAxisY = Input.GetAxis(kMouseY) * m_LookSpeedMouse;
    81.             }
    82.             inputRotateAxisX += (Input.GetAxis(kRightStickX) * m_LookSpeedController * Time.deltaTime);
    83.             inputRotateAxisY += (Input.GetAxis(kRightStickY) * m_LookSpeedController * Time.deltaTime);
    84.  
    85.             float inputChangeSpeed = Input.GetAxis(kSpeedAxis);
    86.             if (inputChangeSpeed != 0.0f)
    87.             {
    88.                 m_MoveSpeed += inputChangeSpeed * m_MoveSpeedIncrement;
    89.                 if (m_MoveSpeed < m_MoveSpeedIncrement) m_MoveSpeed = m_MoveSpeedIncrement;
    90.             }
    91.  
    92.             float inputVertical = Input.GetAxis(kVertical);
    93.             float inputHorizontal = Input.GetAxis(kHorizontal);
    94.             float inputYAxis = Input.GetAxis(kYAxis);
    95.  
    96.             bool moved = inputRotateAxisX != 0.0f || inputRotateAxisY != 0.0f || inputVertical != 0.0f || inputHorizontal != 0.0f || inputYAxis != 0.0f;
    97.             if (moved)
    98.             {
    99.                 float rotationX = transform.localEulerAngles.x;
    100.                 float newRotationY = transform.localEulerAngles.y + inputRotateAxisX;
    101.  
    102.                 // Weird clamping code due to weird Euler angle mapping...
    103.                 float newRotationX = (rotationX - inputRotateAxisY);
    104.                 if (rotationX <= 90.0f && newRotationX >= 0.0f)
    105.                     newRotationX = Mathf.Clamp(newRotationX, 0.0f, 90.0f);
    106.                 if (rotationX >= 270.0f)
    107.                     newRotationX = Mathf.Clamp(newRotationX, 270.0f, 360.0f);
    108.  
    109.                 transform.localRotation = Quaternion.Euler(newRotationX, newRotationY, transform.localEulerAngles.z);
    110.  
    111.                 float moveSpeed = Time.deltaTime * m_MoveSpeed;
    112.                 if (Input.GetMouseButton(1))
    113.                     moveSpeed *= Input.GetKey(KeyCode.LeftShift) ? m_Turbo : 1.0f;
    114.                 else
    115.                     moveSpeed *= Input.GetAxis("Fire1") > 0.0f ? m_Turbo : 1.0f;
    116.                 transform.position += transform.forward * moveSpeed * inputVertical;
    117.                 transform.position += transform.right * moveSpeed * inputHorizontal;
    118.                 transform.position += Vector3.up * moveSpeed * inputYAxis;
    119.             }
    120.         }
    121.        
    122.         void LateUpdate()
    123.         {
    124.             if (isRdpFixEnabled && Input.GetMouseButton(1))
    125.             {
    126.                 Vector3 axis = new Vector3(-(lastAxis.x - Input.mousePosition.x), -(lastAxis.y - Input.mousePosition.y), Input.GetAxis("Mouse ScrollWheel"));
    127.                 lastAxis = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
    128.                 Debug.Log($"MOUSE X = {Input.mousePosition.x}, MOUSE Y = {Input.mousePosition.y}");
    129.                 x += axis.x * xSpeed * 0.02f;
    130.                 y -= axis.y * ySpeed * 0.02f;
    131.                
    132.                 Debug.Log($"X = {x}, Y = {y}, axis = {axis}, axis.x = {-(lastAxis.x - Input.mousePosition.x)}, axis.y = {-(lastAxis.y - Input.mousePosition.y)}");
    133. //y = ClampAngle(y, yMinLimit, yMaxLimit);
    134.                 transform.rotation = Quaternion.Euler(y, x, 0);
    135.             }
    136.         }
    137.     }
    138. }
     
  23. sinaari

    sinaari

    Joined:
    Jan 28, 2019
    Posts:
    47
    So can you confirm that the problem with FreeCamera.cs is not fixable by changing the value of Active Input Handling? If so, then what course of action would you recommend to remedy the problem?
     
  24. sinaari

    sinaari

    Joined:
    Jan 28, 2019
    Posts:
    47
    Could you please explain, what should I do in this situation?

    Do I need to implement some workaround or is there something already available that I'm missing or do I maybe need to install the "Input System preview.6-1.0.0" package?

    Any hints would be greatly appreciated!
     
  25. rekatha

    rekatha

    Joined:
    Dec 18, 2017
    Posts:
    22
    using Unity 2019.3.11f1, RDP

    Input.GetAxis("Mouse X") return 0, always
    Input.GetAxisRaw("Mouse X") return 0, always
     
    Last edited: May 18, 2020
  26. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Please file a ticket with the Unity bug reporter.
     
    karl_jones likes this.
  27. FlavioIT

    FlavioIT

    Joined:
    Apr 20, 2015
    Posts:
    4
    Is this thing still a problem?
     
    NestorAlgieri likes this.
  28. BluEyeBattousai

    BluEyeBattousai

    Joined:
    Dec 13, 2019
    Posts:
    1
    Still having the issue in 2020.1.6f1
     
  29. Notelis

    Notelis

    Joined:
    Aug 2, 2018
    Posts:
    1
    Hi,
    Unfortunately, this issue isn't fixed (Unity 2020.1.6f1 (64-bit)).
     
    Crossway and NestorAlgieri like this.
  30. drylightn

    drylightn

    Joined:
    Oct 21, 2014
    Posts:
    8
    I can also confirm it's not working in (Unity 2020.1.6f1 (64-bit)). Any more news on a fix?
     
    Crossway, NestorAlgieri and T0bD like this.
  31. Robxd0

    Robxd0

    Joined:
    Mar 18, 2015
    Posts:
    3
    No fix as of yet in Unity 2020.1.9f (64-bit). Sorry.
     
  32. pfdaniel

    pfdaniel

    Joined:
    May 3, 2020
    Posts:
    14
    Same issue for us in the latest 2019.4 LTS release
     
    Crossway likes this.
  33. ilmatematico

    ilmatematico

    Joined:
    Feb 17, 2017
    Posts:
    1
    The problem is there but just with the legacy input system. I suggest switching to the new input system in which works like a charm. At least use the new input for the mouseAxis and the rest as it is (build with BOTH in player settings)
     
  34. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    509
    I have same problem with parsec! I can't look around with mouse anymore when I play my game with parsec.
    Unity 2020.1.17f1
     
  35. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    509
    Rene-Damm ,
    karl_jones


    Ok now I use new input system but there is still a big problem with parsec when mouse reaches to the borders of parsec windows it stops working so I can't rotate my character completely (360) :eek:
     
    Last edited: Mar 18, 2022
  36. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    Please file a bug report so we can investigate it.
     
    Crossway likes this.
  37. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    509
    Hi, I send a bug report but nobody answered yet.
    CASE 1411945
     
    karl_jones likes this.
  38. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    Its currently with QA. It may take some time to process.
     
    Crossway likes this.
  39. swedishfisk

    swedishfisk

    Joined:
    Oct 14, 2016
    Posts:
    57
    I ran into this issue now with 2021.3.13 when using windows native RD client and Android app.

    If you play around with Cursor.LockState you can tell the cursor is technically locked on your android device, since you can't click or see hover animation on Unity Editor controls. But you can still see the mouse cursor and mouse/pointer delta doesn't work on edges of screen.

    Was this issue fixed?
     
  40. orcinus

    orcinus

    Joined:
    May 7, 2013
    Posts:
    15
    This is still an issue in 2022.2