2d hingeJoint motor scripting

so im trying to change the motor speed at runtime on the press of a button. i can read the motor speed value but cant change it. whats the reason?

	JointMotor2D rwmotor;
	rwmotor = this.GetComponent<HingeJoint2D> ().motor;
	Debug.Log("" + rwmotor.motorSpeed); //debugs motor speed
	rwmotor.motorSpeed = 0f; //doesnt change anything

Drop .motor from your GetComponent call. This way you pass the script reference and are able to change the values. Otherwise you are just accessing a value.

http://docs.unity3d.com/ScriptReference/HingeJoint-motor.html