Fixed joint doesn't work after gameobject disabled and enabled

  1. I took 2 gameobjects and added rigidbody to it.
  2. Added fixedjoint to one gameobject and put connected body another gameobject.
  3. Both game object move together if I add force to one gameobject.
  4. I disabled connected body gameobject for a moment and then enabled it.
    5.gameobjects are not behaving as per the property of fixed joint. They move separately like there is no joint.

Please help me with this problem

You could try connecting the objects again through script after enabling them.

You’d have to make a Fixed Joint variable to access the fixed joint. like this.

    public FixedJoint joint;
    public GameObject body;

void Update()
    {
        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            body.SetActive(!body.activeSelf);
            joint.connectedBody = body.GetComponent<Rigidbody>();
        }
}