An odd GetComponent error...

I am getting a 'waypoint is not a member of 'UnityEngine.Component' error. And I don't know what is wrong...

CODE WAS HERE.

By the way, I did set up another script called waypoinSoldier and variable waypoint(if you were wondering)

Please tell me what I am doing wrong. Thanks.

EDIT:

CODE WAS HERE.

If you're on the iPhone, it's because it doesn't support dynamic typing, so you have to force the type manually

Alternatively, you could have #pragma strict at the top of your file if you're not on iPhone - it does the exact same thing

var soldier : waypointSoldier = instantiated.GetComponent(waypointSoldier);
soldier.waypoint = hit1.collider;

Note: You should get into the habit of doing that anyway, it's quite a bit slower to do it the way you're trying

Edit:

change

var instantiated : Rigidbody = Instantiate (unit, transform.position, transform.rotation); 

to

var instantiated : waypointSoldier = Instantiate (unit, transform.position, transform.rotation);

That'll be why it wasnt working with transform either (though using the script type is much better)