Passing stuff from script to script (setting change-able waypoints) ....

I am almost done with my game like a game called Phage Wars. In this game you click/drag and release your drag on an enemy building to send troops to attack that building.

I got the dragging done but I need to know how to tell where to send the troops.

Therefore I set up waypoints. Unfortunately the waypoint location is not fixed so I need to know how to set up a way to add the waypoint location where you release your click (which gameObject released on).

I have created a variable called target with a Transform property defined (var target : Transform;). Then I am trying to find where you click and make the waypoint location there.

Unfortunately the waypoint system is in a different script.

So how will I set up a way to access the location of the waypoint in the waypoint script from another script?

Aron's work on A* AI might be of use.

Or to just place a prefab where you clicked the mouse use something like this:

var Prefab  : GameObject ;

function Update () {
    if (Input.GetMouseButtonDown(0)) {
        var ray: Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        var hit: RaycastHit;

        if (Physics.Raycast(ray, hit)) {
          Instantiate(Prefab, hit.point, Quaternion.identity);