camera rotation with mouse,like minecraft

i want to make the camera rotate as i move the mouse,and in each frame mouse cursor get back to the center of the window,if u played minecraft u know what i say.
and i want the cursor to be invisible.
how to do this?

I believe this link contains what you are looking for: Unity - Scripting API: Screen.lockCursor

As far as rotation goes, there is a mouse look script already included in Unity. Refer to Sketcher’s answer for the Screen-lock cursor. The mouse look script is in the standard assets when you create a new project.