This error occurs when I try to lock the cursor in the center of the screen

156 views Asked by At

This is my complete code, can someone help me.

public float rotationSpeed;
public Transform target, player;
float mouseX, mouseY;

void Start()
{
    Cursor.visible = false;
    Cursor.lockState = CursorLockMode; ;
}

void LateUpdate()
{
    cameraControl();
}

Assets\ThirPersonCamerController.cs(14,28): error CS0119: 'CursorLockMode' is a type, which is not valid in the given context

1

There are 1 answers

0
Jay Buckman On

You need to pick a lock mode:

Cursor.lockState = CursorLockMode.Locked;

Your choices are None, Locked, and Confined, but Locked seems to best fit your needs. See the Unity reference at https://docs.unity3d.com/ScriptReference/CursorLockMode.html