how to hide the cursor in unity code example

Example 1: how to lock and hide a cursor unity

//to lock in the centre of window
Cursor.lockState = CursorLockMode.Locked;
//to hide the curser
Cursor.visible = false;


Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;

Example 2: unity hide mouse

Cursor.visible = false;

Example 3: how to make mouse invisible unity

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

Example 4: how to unlock cursor in unity

Cursor.lockState = CursorLockMode.None; // to unlock cursor
Cursor.visible = true; // to make cursor visible