So I am making a FPS game and currently I have a menu screen and the game scene itself. I want to be able to look around with the mouse and I have successfully made it possible to look around with the mouse. However, I can’t see the mouse cursor in the menu screen, due to me coding in:
Cursor.lockState = CursorLockMode.Locked;
What should I add (and where) to make it so my mouse cursor DOES show in the menu screen but DOESN’T show in-game.
Here is the rest of the code for my Player Camera:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseLook : MonoBehaviour
{
public float mouseSpeed = 100f;
public Transform playerBody;
float xRotation = 0f;
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}
void Update()
{
Cursor.visible = false;
float mouseX = Input.GetAxis("Mouse X") * mouseSpeed * Time.deltaTime;
float mouseY = Input.GetAxis("Mouse Y") * mouseSpeed * Time.deltaTime;
xRotation -= mouseY;
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
playerBody.Rotate(Vector3.up * mouseX);
}
}