Adding a cursor lock until you hit esc in the pause menu

How do I add a cursor lock until you hit the esc button in the pause menu

You can lock the cursor using Cursor.lockState http://answers.unity3d.com/questions/topics/lock-cursor.html

Please check the Unity documentation and search other answers (this has been answered many times) before posting on Unity Answers.