Collect all objects in the hierarchy rooted at each of the given objects. This is most useful for linearizing entire GameObject hierarchies including all their components.
function Start () { // Create two GameObjects.
var parent = new GameObject(); parent.name = "Parent";
var child = new GameObject(); child.name = "Child"; // Make one a child of the other.
child.transform.parent = parent.transform; // Collect entire hierarchy.
var result = EditorUtility.CollectDeepHierarchy([parent]); // Dump results. Will log four objects to the console;
// two GameObjects ("Parent" and "Child") and two Transform
// components (one belonging to "Parent" and one belonging to
// "Child").
for (var obj in result) {
Debug.Log(obj);
}
}