I've been looking at answers, and I don't understand them. All I want is a script that will lock the cursor at the center of the screen for a stand-alone game. Just one script, NOTHING ELSE.
I've been looking at threads about this problem and haven't found an easy enough answer, so I thought I'd add my two cents:
It's not a perfect solution bot for prototyping purposes I use this:
Screen.lockCursor moves the pointer to the center of the screen, so it does almost exactly what the OP suggested - resets the cursor every frame.
You could also use a MouseMove event for example :)
Not very clean but it does the job, you retain OnMouseDown functionality, the cursor remains visible.