Check out example codes for "cursorlockmode cannot be used as a method C#". It will help you in understanding the concepts better.

Code Example 1

void Update() {         //Mouse lock and confine         Cursor.visible = false;         Cursor.lockState = CursorLockMode.Locked;         Cursor.lockState = CursorLockMode.Confined;  //and to unlock it is this:         Cursor.lockState = CursorLockMode.None;         Cursor.visible = true; }

Learn ReactJs, React Native from akashmittal.com