Unity 5 Center Cursor

Hi!

I’m trying to lock the mouse on the center of the screen for a first person game, but Cursor.lockState isn’t working. In Monodevelop it doesn’t recognise the ‘=’ sign in the line:

Cursor.lockState = CursorLockMode.Locked;

This worked for me:

function Update () 
    {
       Cursor.visible = false;
       Cursor.lockState = CursorLockMode.Locked;
    }