Raycast help

I’m trying to code a raycast gun heres the code I sort of got.

function Update () {
// Put this in your update function
    if (Input.GetButtonDown("Fire1")) {
        var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
        var hit : RaycastHit;
        if (Physics.Raycast (ray, hit, 100)) {
            print ("Hit something");

but it dosn’t seem to print anything on the debug line after I press the fire button in front of an object with a collider :confused: what am I doing wrong?

You know this will only detect things if the mouse pointer is over them, right? So mouse-over something with a collider on it that’s not too far away and hit the Fire1 button, it should print.