How to enable a specific gameobject child.


How could I enable a specific gameobject whicih is a child of an object that gets instanitates.

So something like this:

GameObject object1;

            object1 = Instantiate(Object2, transform.position, Quaternion.identity) as GameObject;

            if(foo == true)
                object1.enableInChildren("object2").enabled = true;  //this line is just an example, this is the part where I want to enable the child

object2 always starts disabled and will have to, i only want to enable it when something is true.

You can set up the references for prefabs in the inspector. Or you can use Transform.Find