disable mouse unity

C#
 Cursor.lockState = CursorLockMode.locked; 
 Cursor.visible = false;
Source

Also in C#: