Search Unity

Bug why my first person camera stutters/lag in editor ?

Discussion in 'Editor & General Support' started by Sheppowed, Jul 18, 2021.

  1. Sheppowed

    Sheppowed

    Joined:
    Mar 9, 2020
    Posts:
    1
    I made a first person controller with a camera and with the new input system. Sometimes when i go in playmode , the camera movement seems laggy or jerky. When i use a controller, the problem disappears but the sensitivity is very low (slow camera).

    when i run the game in a build version , there is not lag at all but the mouse sensitivity is boosted up

    do you have any ideas why this happens ? , I started to learn unity and C# a few weeks ago and I already feel like I'm going to give up

    Code (CSharp):
    1.     private void MoveCamera()
    2.     {
    3.         Vector2 MouseAxis = m_inputManager.GetMouseDelta();
    4.  
    5.         float MouseX = MouseAxis.x * CameraSensitivity * Time.deltaTime;
    6.         float MouseY = MouseAxis.y * CameraSensitivity * Time.deltaTime;
    7.  
    8.         xRot -= MouseY;
    9.         xRot = Mathf.Clamp(xRot, MinClamp, MaxClamp);
    10.  
    11.         m_camHolder.transform.localRotation = Quaternion.Euler(xRot, 0f, 0f);
    12.         transform.Rotate(Vector3.up * MouseX);
    13.     }