FixedJoints wiggling when too many are put together?

hi i have this script

var obj : FixedJoint;
var wallParts : int = 20;
function Start () {
    for(i=wallParts;i>0;i--){
        var cube = Instantiate(obj,Vector3(transform.position.x+i,transform.position.y,transform.position.z),transform.rotation);
        cube.gameObject.name = "brick" + i.ToString();
        cube.transform.parent = transform;
        if(i <wallParts){
        var cubes = GameObject.Find("brick"+(i+1).ToString());
        cube.connectedBody = cubes.rigidbody;
        }
    }
}

So what this does is creates a wall of fixed joint cubes. all of them are connected to the next one. but it seems to not hold together when i make it large enough. any help would be nice!

Generally you should limit the length of joint chains but there are ways to make it more stable. Switching to a configurable joint and setting a higher dampening value will stop it jittering so much. (fixed joint is just a configurable joint with less options).

You can also set a higher linear limit to lessen the snap back effect from too many joints.

You can also do things like setting higher drag value on the rigidbodies and making them all sleep at the start of the game to stop them moving around right away also helps. If the cubes are stacked on top of each other you can also set a higher penetration value in the physics setting to allow the cubes to move into each other a little bit more before being forced apart which might be what's causing the jitter.

e.g.

function Awake(){
   rigidbody.Sleep();
}