Screen.lockCursor will not work

I have a strange problem where unity will not lock my cursor.

void Start() {
        Screen.lockCursor = true;
}

I have no idea whats going on. I have looked it up and some answers say it is a bug in
the editor, but I have also built the project for web and desktop and it still refuses to lock the cursor. Does anyone know whats wrong?
Update: I have tried placing the code in other voids like OnMouseDown. Edit: my mistake. It was in the start void not update. I still can’t figure out what the issue is? Should I post my entire class?

Read the documentation of what it says about lockCursor function here:

http://docs.unity3d.com/ScriptReference/Screen-lockCursor.html

You would only need to set it once, in a Start method or similar, you don’t need to call it every time. It stays locked until you tell it to be unlocked.

If this still doesn’t help, then you need to post little more information.
Do you unlock the cursor at any time, any where, in any script?
Is the script where you lock the cursor active? Is the lock cursor even called?

You can check this by adding a debug call:

void Update() 
{
  Screen.lockCursor = true;
  Debug.Log("Screen.lockCursor: " + Screen.lockCursor);
}

If the debug log doesn’t appear, then the script/method is not called.

I hope this gives you a little help to solve the issue!

Good luck!