Mouse not locking to screen

void Start() {
        playerScale =  transform.localScale;
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
    }

private void Update() {
        MyInput();
        Look();
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
    }

I am using this code trying to lock the cursor so I can test my 3d game but it just isn’t locking. It is making this very difficult for development and I have no idea what to do, I am using unity editor 6.0.