OnMouseUp() Update? Movement.

Hi, I am trying to figure out whether OnMouseUp() updates per frame or not among a few other things. the reason being, I am trying to get my game object to move from point A to point B when I use OnMouseUp (character is clicked on, then the player drags the mouse to point B, then upon release of the mouse button the character moves from point A to B).

I am able to select the character and detect the mouse dragging. I am having trouble when I release for the character to move to point B and show the object traveling rather than appearing there. I will post my code. Thank you very much.

    #pragma strict
    
    var target : Transform;
    var speed : float;
    var selected = false;
    
    
    function Start () {
    
    }
    
    function Update () {
    
    if (selected){
    
    // The step size is equal to speed times frame time.        
    var step = speed * Time.deltaTime;               
    
     // Move our position a step closer to the target.       
     transform.position = Vector3.MoveTowards(transform.position, target.position, step);
    }
    
    }
    
    function OnMouseUp() {
    
    Debug.Log ("Drag Ended.");
    
    var step = speed * Time.deltaTime;
    transform.position = Vector3.MoveTowards(transform.position, Input.mousePosition, step);
    
    }
    
    function OnMouseDrag(){
    
       var move = transform.TransformDirection(Vector3(0, 0, 77));
    
       renderer.material.color -= Color.blue * Time.deltaTime;
    	
    	Debug.DrawRay(transform.position, move, Color.red);
    	
    if (Physics.Raycast(transform.position, move, 77)){
    Debug.Log("Hi.");
    }
    }

looks like you aren’t giving the raycast the opportunity to go where you click, you are clamping it to a certain set of variables.

var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray, 100)) {
    print ("Hit something");
}

from Unity - Scripting API: Physics.Raycast

you could also try moving the debug to OUTSIDE of the if{} statement, this would let you know if the drag is working all the time, and not based on the condition you have set