private var ray:Ray;
private var hit:RaycastHit;
function Start () {
}
function Update () {
if(Input.GetMouseButton(0)){
ray=Camera.main.ScreenPointToRay(Input.mousePosition);
if(Physics.Raycast(ray,hit)){
transform.position.x=hit.point.x;
transform.position.y=hit.point.y;
}
}
}
so i was using this script to do a drag and drop and it worked fine, but when i have multiple objects with this script attached to them once i drag one all the others move with how can i edit this script so that i drag only the one i want to drag
thanks
why use of hit.transform.name == transform.name
– userunity