Hi, how do I get a specific children from a game object via script? I use this way, but I don’t think it’s the best though, since it cause problems if there’s a game object with the same name.
GameObject model = GameObject.Find("/" + name + "/model");
Hello,
If you want to know which are the childrens given a transform. you could doit like this:
for( var child : Transform in transform){
if(child.name == "your child name"){
Debug.Log("Found the child")
}
}
you can also do it with the GetInstanceID() function Applying it to an Object.
Hope it helps!
Juan
Hola!
Thanks for the help, your code works just fine
But I found another function that works without doing a loop (well, i don’t know if it actually does not behind the scenes).
GameObject model = transform.Find("model").gameObject;