Adding many fixed joints to one gameobject?

Heyhey, I want a function that connects all the objects in the near surrounding with my object, using fixed joints. Here some code:

arr = Physics.OverlapSphere(transform.position, 1);
for(i = 0; i < arr.length; i++) {
	gameObject.AddComponent("FixedJoint");
	transform.GetComponent(FixedJoint).connectedBody = arr[i].rigidbody;
}

This obviously doesn’t work so and ends in “NpScene::createJoint: desc.isValid() fails!”. How this should look like? Is it even possible to do or do I have to instantiate many objects, each carrying a fixed joints and then parenting them?

No idea?

The problem might be that transform.GetComponent(FixedJoint).connectedBody doesn’t work when the object has attached more then one fixed joint. So, there is no hope for this approach?

sure there is and its actually what you should do when you care about performance / load time / startup time

gameObject.AddComponent("FixedJoint");
transform.GetComponent(FixedJoint).connectedBody = arr[i].rigidbody;

becomes

var fixedJoint : FixedJoint = gameObject.AddComponent(FixedJoint);
fixedJoint.connectedBody = arr[i].rigidbody;

Oh! Ok, now this is a obvious solution ashamed Thanks for pointing it out =)