- Home /
Question by
Trollvahkiin · Nov 23, 2014 at 11:05 PM ·
gameobjectchild object
How to enable a specific gameobject child.
Hey,
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.
Comment
Best Answer
Answer by Kiwasi · Nov 23, 2014 at 11:12 PM
You can set up the references for prefabs in the inspector. Or you can use Transform.Find
Your answer
Follow this Question
Related Questions
How to avoid gameObjects mixing/clipping with each other? 3 Answers
how to separate child gameobject from parent 1 Answer
Can You Convert a Transform into an Image? 2 Answers
Get children of another object in hierarchy. 1 Answer
How to change one child object to another with the same armature? 0 Answers