I am instantiating a prefab which then spawns baby prefabs of itself. This is all working fine, but in the loop that spawns the new prefab, the rigid body on that prefab does not exist, which means I cannot attatch a FixedJoint to it. Why is this? I should think the new prefab would have all the components before the code trying to access it is called?
GameObject newBlock = (GameObject)Instantiate(gameObject,transform.localPosition,Quaternion.identity);
newBlock.transform.parent = transform;
FixedJoint newJoint = new FixedJoint();
newJoint.connectedBody = newBlock.rigidbody;//Error here
center.AddComponent(newJoint);