Search Issue Tracker
By Design
Votes
0
Found in
2018.3.6f1
Issue ID
1132058
Regression
No
[WebGL] Mouse Input.GetAxis is not detected in WebGL until Controller is connected
How to reproduce:
1. Open attached Unity project
2. Build and Run on WebGL
3. Press "Space" until MainGame scene is loaded
4. Move mouse side to side
Expected result: View is controlled by the mouse movement.
Actual result: Mouse movement doesn't control view.
Reproduced with:2019.2.0a7, 2019.1.0b6, 2018.3.7f1.
Notes:
After connecting the controller mouse movement starts to control the view. Disconnecting controller leads to not detecting mouse movements again.
In Standalone build mouse movements are not detected at first, but issue fixes after connecting controller and does not appear again after disconnecting it.
Can't test on 2017.4 because of errors.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
Resolution Note (2019.2.X):
It is not a bug, please see the code. In case of WebGL use development build - it will show that there was an exception in GetJoystick function.
If you try to write
```
try
{
Vector2 leftJoystick =
PlayerInputManager.Instance.GetLeftJoystick(PlayerInputManager.ControllerInput.Controller1);
m_CharacterController.Move(transform.forward * leftJoystick.y * VELOCITY * Time.deltaTime);
m_CharacterController.Move(transform.right * leftJoystick.x * VELOCITY * Time.deltaTime);
Vector2 rightJoystick =
PlayerInputManager.Instance.GetRightJoystick(PlayerInputManager.ControllerInput.Controller1);
AddYaw(rightJoystick.x);
AddPitch(-rightJoystick.y);
}
catch
{
}
AddYaw(Input.GetAxis("Mouse X") * MOUSE_SENSITIVITY);
AddPitch(-Input.GetAxis("Mouse Y") * MOUSE_SENSITIVITY);
```
instead - you will see that it works. Mouse wasn't working because C# exception was raised just before mouse code, so it never gets called.