If child.name == String problem

Hi to all! I have a very simple problem which is driving me crazy:

for (var child :Transform in transform)
{
     print(child.name);
     if(child.name=="ChildX")
     {
          print("I would love to see this message in the console");
          break;
     }
}

Now, the first print is working fine. ChildX is in there. The second print, no.The child.name condition is never satisfied… It must be dead simple, what am I doing wrong? Many thanks for your help,

Gregzo

Maybe you have a space or something in the name of ChildX? How about case sensitivity?

Try this:

print("[" + child.name + "] " + child.name.Length + " characters long");

to see if there are any whitespace in the name. The length should be 6 for your string.