Colliding with the tag of a Child Object

INFO… I have a Empty with A few Cubes in it as my “Block” GameObject w/rigidbody. The Cube’s each have six box collider’s on each side that are flat and a tag of Y-,Y+,X-,X+,Z-,Z+ depending where the side is in world space.

Question… I need to find out if the “Block” I’m controlling has collided with a Child tag of another “Block” I Have in the scene.

So this is what I would like if it is possible.

function OnCollisionEnter(other : Collision)
{
	if (""other.child.tag"" == "Y-")
	{
		DO SOMETHING;
	}
}

not sure what to put in the ““other.child.tag”” part

When I use

function OnCollisionEnter(other : Collision)
{
	if (other.gameObject.tag == "Y-")
	{
		Do Something;
	}
}

It does nothing, and I’m guessing because its getting the parents tag not the child’s.

UPDATE…I wanted to clarify my set up. I have a empty with a rigidbody. In that empty I have a cube that has six child colliders as the sides. I need my collider code to be with the empty.

HERE is my final answer:

first off, to see exactly what collision message is being sent, just try this first:

function OnCollisionEnter(other : Collision)
{
Debug.Log("HIT! :" + other.gameObject);
}

1: Using your setup, provided the collision is entered at all, you will see that the Debug log gives the name of the PARENT, because that is what has the RIGIDBODY.

2: No problem… now try this:

function OnCollisionEnter(other : Collision)
{
Debug.Log("HIT! :" + other.gameObject);
Debug.Log("HIT! Collider: " + other.collider.gameObject);
}

The second line will give you the name of the ACTUAL OBJECT WITH THE COLLIDER, the child itself… This works, I just tested it.

If you are not getting any Debug.Log message at all as a result of this test script, you have some other aspect set up wrong of what “OnCollisionEnter” needs to work right… in which case check out here:

http://unitygems.com/mistakes1/

http://docs.unity3d.com/Documentation/Components/class-BoxCollider.html

you are right about the not having it set up right. I now have the Main empty with 4 cube objects, each of the cube’s have six collision boxes that have rigidebodys with this ontriggerenter

function OnTriggerEnter (col : Collider)
{ 
	if(col.transform.IsChildOf(transform.parent.parent))
		{
			//Debug.Log (col.gameObject.name);
		}
		else
		{
			Debug.Log (col.gameObject.name + col.gameObject.tag);

		}
}