Selecting through raycast

I want to get the object that was hit by a ray, but can't find out how. Help?

You could use raycastHit to get the object:

    var hit : RaycastHit;
    var object : GameObject
if (Physics.Raycast (transform.position, -Vector3.forward, hit)) {
    object = hit.collider.gameObject
}