I’ve upgraded my project to the new input system and created a new camera look script from a tutorial I found. In my editor everything runs very well but once it’s built the camera stutters whenever I look around. Anyone have an idea why?
https://vimeo.com/712245743
public class MouseLook : MonoBehaviour
{
#pragma warning disable 649
public float sensitivityX = 1f;
public float sensitivityY = 0.5f;
float mouseX, mouseY;
[SerializeField] Transform playerCamera;
[SerializeField] float xClamp = 85f;
float xRotation = 0f;
private void Start()
{
Application.targetFrameRate = 300;
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
private void Update()
{
transform.Rotate(Vector3.up, mouseX * Time.deltaTime);
xRotation -= mouseY;
xRotation = Mathf.Clamp(xRotation, -xClamp, xClamp);
Vector3 targetRotation = transform.eulerAngles;
targetRotation.x = xRotation;
playerCamera.eulerAngles = targetRotation;
}
public void ReceiveInput(Vector2 mouseInput)
{
mouseX = mouseInput.x * sensitivityX;
mouseY = mouseInput.y * sensitivityY;
}
}