Search Unity

Bug When the mouse moves to the edge of the screen, the new GetAxis return value cannot be obtained.

Discussion in 'Web' started by ZhangXiaoYuan568, Mar 3, 2023.

  1. ZhangXiaoYuan568

    ZhangXiaoYuan568

    Joined:
    Mar 22, 2021
    Posts:
    1
    :) When the mouse moves to the edge of the screen, Input.GetAxisRaw will no longer refresh and will always be 0. How to solve this problem?

    Code (CSharp):
    1.     public float MouseX;
    2.     public float MouseY;
    3.  
    4.     void Update()
    5.     {
    6.         MouseX = Input.GetAxisRaw("Mouse X");
    7.         MouseY = Input.GetAxisRaw("Mouse Y");
    8.     }