Problem Button Click with Cursor, Cursor attach the gameobject

Hi! I have problem with Cursor press button it cursor attach gameobject, Cursor again click detach with gameobject, Click right destroy Gameobject with mouse.

How do you not understand, it example: Here

I needs it, Help me!

Dude this code might help you with the attach and the detach, although I didn’t try but I did something similar lately,
you have to attach this script to the gameObject that you want to attach/detach.

and concerning the destroy, the guys will help you or if i get smth soon, i’ll post here!

private isAttached = false;
private var curScreenPoint:Vector3;
private var curPosition:Vector3;

function OnMouseDown()
{
screenPoint_Globe = GlobeCam.WorldToScreenPoint(gameObject.transform.position);

if(isAttached)
{ isAttached = false; }

if(!isAttached)
{ isAttached = true; }

}

function Update()
{
if(isAttached)
{
curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint_Globe.z);
curPosition = GlobeCam.ScreenToWorldPoint(curScreenPoint);

  gameObject.transform.position = curPosition;

}
}

How do you not understand? similar to Unity3D - Minecraft-style game - YouTube