Breaking joints

So I have this:

void OnCollisionEnter(Collision c) 
    var joint = gameObject.AddComponent<FixedJoint>();
    joint.connectedBody = c.rigidbody;

and its tied to the object I am picking up but I want to be able to delete this joint when I press a key so I can drop the object I picked up with

Destroy (joint);

would I put that in the same class in the Update() method?

Declare the variable as class member instead of locally in the function, so it’ll be null by default and assigned in OnCollisionEnter, then when you’ll need to delete you’ll call Destroy(joint) and set the variable back to null.