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
- Unnecessary modifications clutter the Scene when using a RectTransform driven by a LayoutGroup in a Prefab
- Files in the target folder are deleted without a proper warning when building an iOS project
- Character animation freezes when toggling animator on/off in a coroutine
- Certain textures are incorrectly marked in the render pass list when observed through Render Graph Viewer
- "Assertion failed on expression" error occurs when multiple Animation Components are instantiated after changing the Culling Type
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.