How to traverse scene hierarchy?

Is there a way to go through the scene hierarchy so I know the parent-child relationship?

FindObjectsOfType() returns a flat list right?

I’m sure there’s a more elegant solution, but you could always build an array of the type of objects you’re interested in and then traverse the hierarcy of each (top level) object in that array by looping through the transform.

not quite what I need.

I’m trying to build an anatomy browser and would like to construct a hierarchal list of all the objects ( lots of them ) so when the user can see the system an organ belogs to e.g

gi tract
…stomach
…liver
…small itestine
…something else

I have the organs organized by system already on the Maya file.
Been able to know the child nodes of an object and access them is essential, I would be surprise Unity does not have methods for this purpose. :shock:

It does. Read the docs on the transform class. :wink:

Yes, that’s what I needed :smile:
thank you!