Multiple gameobjects - one event

I want to drag-drop one object, but I have more such kind of objects and the behaviour happens for all, but I want to drag just the selected item. Some behaviours are working well, just for the selected object, but this one no.Please help me to improve this code.

void Start () {

	initialPosition = new Vector3 (transform.position.x,transform.position.y,transform.position.z);	
	void Update () {	

		mouseDown = true;
		mouseDown = false;
		grabbed = false;
		this.transform.position = initialPosition;
		point = Camera.main.ScreenToWorldPoint(Input.mousePosition);

		if(point.x >= (transform.position.x - renderer.bounds.size.x/2) && point.x <= (transform.position.x + renderer.bounds.size.x/2))
			if(point.y >= (transform.position.y - renderer.bounds.size.y/2) && point.y <= (transform.position.y + renderer.bounds.size.y/2))
				grabbed = true;
			transform.position = new Vector3(point.x, point.y, transform.position.z);
			foodMovingPosition = transform.position;

For your purpose, it’s better to use Raycast, since you must track the mouse pointer position. This script uses the variable pickObj to save the reference to the picked object. While nothing is picked, pickObj is null. When the left mouse button is pressed, it casts a ray from the mouse pointer and - if some object tagged “Pick” is hit - saves the object transform in pickObj (if the object is a rigidbody, its velocity is nulled to avoid weird movements when it’s released).

While the mouse button is pressed, pickObj is moved to the mouse pointer position. Since the screen is 2D, the script uses the distance from the camera (ray origin) to the object to define a 3D point with GetPoint(distance). When the mouse button is released, pickObj is set to null to signal nothing is picked.

private var pickObj: Transform = null;
private var hit: RaycastHit;
private var dist: float;

function Update(){
	if (Input.GetMouseButton(0)){
		var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
		if (!pickObj){ 
			if (Physics.Raycast(ray, hit) && hit.transform.tag == "Pick"){ 
				if (hit.rigidbody) hit.rigidbody.velocity =;
				pickObj = hit.transform; 
				dist = Vector3.Distance(pickObj.position, Camera.main.transform.position);
		else {
			newPos = ray.GetPoint(dist); 
			pickObj.position = newPos;
	else { 
		pickObj = null;