... void SetMotor(float speed) { var motor = hingeJoint.motor; motor.force = speed; hingeJoint.motor = motor; } ...