Picking up and dropping a sticky object

So I am trying to pick up an object that is sticky. What it does currently works but I cant drop the cube that I am picking up. I don’t think I am destroying the FixedJoint correctly. Any ideas on how to drop the sticky object when I press the delete key? Below is the StickyObject script I am using:

using UnityEngine;
using System.Collections;

public class StickyObject : MonoBehaviour {
	FixedJoint joint;
	void Start () {
	
	}

	void Update () {
		if (Input.GetKeyDown(KeyCode.Delete)) {
			if (joint != null) {
				Destroy(joint);
				joint = null;
			}
		}
	}
	void OnCollisionEnter(Collision c) 
	{ 
		joint = gameObject.AddComponent<FixedJoint>();
		joint.connectedBody = c.rigidbody;

	}

}

you can edit propertys of a joint such as the connected rigidbody, if u really desire to destroy the fixed joint it is possible but you could also just disconnect in the same manner that you connected them IE.

joint.connectedBody = null;

and this line you have is redundant

joint = null;

given that when the rigidbody is destroyed, it will automatically set this property to null as it will no longer exist. If disconnecting the components does not work or isn’t ideal Let me know and ill have a play around with the code.

EDIT – for code inclusion

public class StickyObject : MonoBehaviour {

		public FixedJoint joint;

		void Start () {
			
		}
		
		void Update () {
			if (Input.GetKeyDown(KeyCode.Tab) && joint != null) {
				//Destroy(joint);
				joint.connectedBody = null;
			}
		}
		void OnCollisionEnter(Collision c) 
		{ 
		if(joint == null) {
				joint = gameObject.AddComponent<FixedJoint>();
				joint.connectedBody = c.rigidbody;
			}
		}
}