Checking Child collisions through parents

Im learning unity right now. I made a Scene with four walls(Below): alt text

They are named Front wall,Back wall,Right wall,etc...

All Four walls are Children of an Empty game Object called "wall". In a script I use a ray to detect if those small sphere have collided with any of the walls through the Parent called "wall". It does not return the Debug message.

Here is the raycast code:

function Update () {
    var cast_col : RaycastHit;
    Debug.DrawRay(transform.position,Vector3(0,0,1)*3,Color.black);

    if (Physics.Raycast(transform.position,Vector3(0,0,1),cast_col,3))
    {
        if(cast_col.collider.gameObject.name == "wall")
        {
            Debug.Log("Hit!");
        }
    }
}

Whats wrong? Can i even check collision of all the children of a parent by checking collisions with the parent?

As you see I write in JavaScript so any code i would appreciate if it is in Java.

Thanks :D

Basically, your problem is that you are getting the child gameobject name, and not the parent's. What you need is this:

if(cast_col.collider.gameObject.parent.name == "wall") { Debug.Log("Hit!"); }