HingeJoint2D.GetReactionForce not working

Since the 2D joints in unity do not seem to have a break force/torque built in, I wanted to write it in a script myself by reading the joints reaction force in the following code:

var breakForce : float = 100;
private var jointForce : float;

function Start() {
var joint = gameObject.AddComponent(HingeJoint2D);
}

function FixedUpdate() {
	jointForce=joint.GetReactionForce;
	if (jointForce>breakForce) {
		Destroy(joint);
	}
}

The documentation says that HingeJoint2D.GetReactionForce should be possible:
http://docs.unity3d.com/ScriptReference/HingeJoint2D.GetReactionForce.html

However unity tells me: ‘GetReactionForce’ is not a member of ‘UnityEngine.HingeJoint2D’.
This made me very confused. I hope someone can help me!

Your code should be something like this:

var breakForce : float = 100;
private var jointForce : Vector2;
var joint : HingeJoint2D;
 
function Start() {
	joint = gameObject.AddComponent(HingeJoint2D);
}
 
function FixedUpdate() {
    jointForce = joint.GetReactionForce ( Time.deltaTime );
    if (jointForce.magnitude > breakForce) {
       Destroy(joint);
    }
}

GetReactionForce returns Vector2 type. You can’t convert to float directly. And declare ‘joint’ as a HingeJoint2D’ type. You might compare jointforce’s magnitude with the variable ‘breakForce’.