The question is answered, right answer was accepted
Camera becomes snappy when I build and run my game.
I'm making a first person game. The camera works fine in game view, but whenever I build and run my game it becomes snappy as if the game were lagging. I pulled up my fps to make sure it wasn't just lag that was doing it, and sure enough, I was running on very high fps. I've been troubleshooting for several hours now, even to the point of simplifying my camera script. Is there a better way to do this? What am I doing wrong?
Code:
using System.Threading;
using UnityEditor;
using UnityEngine;
public class PlayerLook : MonoBehaviour{
public float mouseSensitivity = 600f;
public Transform playerBody;
float xRotation = 0f;
void Start(){
Cursor.lockState = CursorLockMode.Locked;
//GameObject player = GameObject.Find("Player");
//MainMenu menu = player.GetComponent<MainMenu>();
}
void FixedUpdate() {
float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;
xRotation -= mouseY;
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
playerBody.Rotate(Vector3.up * mouseX);
}
Is the code outdated by chance? I am running Unity 2020.1.4f1. I'm more than glad to give more details if needed. Thank you!
Edit: found the issue, I just changed "fixedupdate" to "update". Sorry!
Follow this Question
Related Questions
Snap object to the local grid. 1 Answer
uNet FPS Camera Error [C#] [Unity 5] 2 Answers
How to configure my camera ?? 0 Answers
Text that always looks at you 1 Answer
Tagging Doors and Windows 0 Answers