Finding a Child Object

I am trying to work out how to find a child object. The parent object being called someObject in the example below.

exampleGameObject = GameObject.Find ("someObject").GetComponent<Transform>();

Would “someParentObject.someChildObject” be a correct way of finding the child object, or is there a different way of doing it?

Thank you.

Parentobject.tranform.getchilds

1 Like

I have fixed the issue.

I was over-thinking how to find the Child. someParentObj.someChildObj was not required. Just naming the Child without referencing the Parent works fine.

exampleGameObject = GameObject.Find ("someChildObject").GetComponent<Transform>():

Transform.Find is better for searching children.

GameObject.Find will search the entire hierarchy. Transform.Find is limited to children.

1 Like