Mouse lock

this is my script

Function Update () {
    Screen.lockCursor

}

Im trying to lock the mouse in the center of the screen can anyone help me with this.

Screen.lockCursor is a bool, so you’ll need to set it to true/false.

Also, you probably don’t need to set it every time Update runs, consider doing it in Start() instead.

For optimization sake do it once every so often. I would do it in function Start

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