public void Detach() { if (!attached) { return; // if it isn't attached, it can't detach } attachedToScript.DetachBucket(); attachedToScript = null; attached = false; }