mouse view rotation not working

I am following this tutorial:

and, at 14:39, Where he starts scripting the camera mouse rotation, my script does not work

this is my code:

        if (Input.GetMouseButton(2))
        {
            rotStartPos = Input.mousePosition;
        }
        if (Input.GetMouseButton(2))
        {
            rotCurrentPos = Input.mousePosition;

            Vector3 difference = rotStartPos - rotCurrentPos;

            rotStartPos = rotCurrentPos;       

            newRot *= Quaternion.Euler(Vector3.up * (-difference.x / 5f));
        }

I also find it strange of getting the difference of the same Vectors of therotStartPos - rotCurrentPos So, is there a way to fix it?

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

To help gain more insight into your problem, I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.

Doing this should help you answer these types of questions:

  • is this code even running? which parts are running? how often does it run?
  • what are the values of the variables involved? Are they initialized?

Knowing this information will help you reason about the behavior you are seeing.

never mind at line 1 it’s (Input.GetMouseButtonDown(2))