RTS Unit Selection

I am making an RTS game. In it, I need bo be able to select units. I am able to get a transform from a raycast, but going any farther than that I can’t do. The biggest problem that I am having has arisen through my use of Aron Granberg’s A* pathfinding. With that method, any unit that you want to move must be of type Seeker. That is achieved by adding the Seeker script to whatever you want to move as a component. One would then think that the object that was hit with a raycast could be given the Seeker script as a component, but the AddComponent() method only works for GameObjects, and near as I can tell, a raycast doesn’t return a GameObject. I feel like I’m missing something here, though. Here’s my code (I’m using C#):

public GameObject selected;
RaycastHit hit;
if( Input.GetKeyDown("mouse 0") )
{
Ray ray = camera.ScreenPointToRay (Input.mousePosition);
if( Physics.Raycast( ray, out hit, 100000F, mask) ) 
{
selected = (GameObject)hit.collider;
selected.AddComponent(Seeker);
}
}

Note that this code won’t compine, Unity can’t convert type collider (or transform or whatever else you can think of) to type GameObject. I’ve tried.

selected = hit.collider.gameObject;