Input.GetAxis() wrong values on laptops
Hi, I'm making a 2D project and I'm trying to use the User input to move the camera (top view). I did it with this function attached to a mono behavior component on the camera object:
void LateUpdate(){
var movex = Input.GetAxisRaw("Horizontal");
var movey = Input.GetAxisRaw("Vertical");
move = new Vector2(movex, movey).normalized;
speed = cam.orthographicSize * 2;
if(Time.timeScale > 0) {
rb.velocity = move * speed / Time.timeScale;
}
}
It works very fine, but as soon as I open the project (built or through unity editor) on a laptop, the camera starts drifting uncontrollably in a constant direction (-1,1).
I investigated some more and I found out that moveX is always equal to -1 and moveY to 1 if the game windows is active. They both return to 0 when the game is out of focus (other window selected).
Again, this only happens on laptops...
This behavior is very weird, anyone has an idea of the cause or of the potential fix to this issue?
Your answer
Follow this Question
Related Questions
XboxCtrlrInput Dead Zone 0 Answers
Input.GetAxisRaw with New Input System? 0 Answers
XInput D-Pad and Triggers not working 0 Answers
Why isn't my basic input script working? 0 Answers
i put space under jump in the input manager "not working" 0 Answers