Detect if dragged over object

Is there a way to detect if the user has been holding down the input button (whether it be a mouse or a touch) and during that time they moved over a gameobject with a boxcollider on it?

Basically I am trying to see if I can start touching outside of the gameobject’s bounds and while still touching, drag overtop of the gameobject (kind of like selecting multiple characters in a string with your finder/mouse) and I want the gameobject to then detect “Hey, I see that you started touching somewhere else, but while you were still touching you dragged overtop of me! Now I am going to do something!”

Try using…

OnMouseEnter() {
    
  if (Input.GetMouseButtonDown(0)){
    // DO SOMETHING
  }
}