How to make an object appear only when I click and not when I drag

How to make an object appear only when I click and not when I drag

void Start () 
    {
        col = GetComponent<Collider>();
        handler = new newClass();
        visible = false;
        newPosition = canv.transform.position;

	}

    void Update()
    {
        if (Input.GetMouseButtonDown(0) ) 
        { 
            isDown = true;
            handler.ray = handler.mainCamera.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (col.Raycast(handler.ray, out hit, 100.0f))
            {
                //  handler.Delete(gameObject);
                canv.transform.position = new Vector3(transform.position.x, transform.position.y + 2f, transform.position.z);


            }
          
      }
        if (Input.GetMouseButton(0))
            canv.transform.position = newPosition;
    }

The problem is that on I get MouseButtonDown the MouseDrag(Mousebutton) is also registered, How I can make to not register it, so when I drag it will go with mousebuttondrag, and when I click it will go only with mousebuttonDown

I would recommend you to use new unity EventSystems. For example, if you want to catch clicks on your gameObjects, just implement IPointerClickHandler interface in script, attached to your gameObject. And then, when click on your object happens, OnPointerClick message will be called. You also need to add PhysicsRaycaster component to your main camera. Don’t forget to do that.

Example code:

 public class FindableObject : MonoBehaviour, IPointerClickHandler
 {
     public void OnPointerClick (PointerEventData eventData)
     {
         Debug.Log ("OnPointerClick " + gameObject.name);
     }
 }

This event will not be called if you drag element. For drag event you can implement another interface. Just check EventSystems’ interfaces in documentation

this script looked like you are trying to drag and place something. have you looked into using Input.GetMouseButtonUp()?