A bug where fixed joints become really soft [ Found error]

Ok so, in my game I have a bounch of “parts” joined together with jonts ( I use HingerJoint2d because they are more solid than fixed joints… yeah kinda weird that they are but whatever)

So it appears that the problem starts when this code is activated ( It could be something else that comes with it idk):

    public void DestroyJoint( HingeJoint2D j ){ // Destroys the joint, and updates all the parts affected by it

        Part start = j.GetComponent<Part>(); // The part from where the joint comes from
        Part other = j.connectedBody.GetComponent<Part>(); // The part that the joint is connected to

        start.joints.Remove (j); // Removes the joint from the List<joints> joints
        other.joints.Remove (j);

        start.UpdateConnected (); // Updates what part is connected where ( so it can recalculate drag surfaces)
        other.UpdateConnected ();

        VesselController v = j.GetComponentInParent<VesselController>(); // Tells the controller that it should recalculate connections
        if (v != null)
            v.reConnect = true;

        // If it had to do with engines / fuel tanks in the vessel
        Ref.reEngines = true;

        DestroyImmediate( j);
    }
    }

So right after this code is executed, ALL the other joint in the game turn into jelly.

Here is a gif of it: ( sry could not hey it to show directly)

As you can see, the physics work well until I separate that grey piece, by breaking the joint using the code above

I’m guessing the code might change something in the physics settings or something?

This bug is completely game breaking and there is no way I can publish the game if this bug isn’t fixed, so I would really appreciate if someone knows what is going on.

So after checking each individual line, by commenting it out and seeing if it fixes the bug.

The problem was in this line:

VesselController v = j.GetComponentInParent<VesselController>(); // Tells the controller that it should recalculate connections
        if (v != null)
            v.reConnect = true;

The problem was that, the script that uses the variable “reConnect” didn’t set it back to false, and performing the Reconnecting function each frame.

What the Reconnecting function did was unparent and then parent all the parts transform, making the physics do weird things.