Hi there,
I am wondering what the procedure is to find a child gameObject.
I am using this…
for (var child : Transform in transform)
{
}
but it provides the transform. I need child to be a gameObject.
Hi there,
I am wondering what the procedure is to find a child gameObject.
I am using this…
for (var child : Transform in transform)
{
}
but it provides the transform. I need child to be a gameObject.
If you have a specific child you’re looking for:
var child : GameObject = transform.Find ("TheChild").gameObject;
Otherwise, you can use your code:
for (var child : Transform in transform) {
//child.gameObject
}
You can use the method (gameObject.FindChild(Yourchildnamehere)) to find a child with a certain name
This thread is 8 years old…
I’m sure the person has figured it out by now.