public void BuildHierarchy() { Transform transform = this.get_transform(); int childCount = transform.get_childCount(); for (int i = 0; i < childCount; i++) { DynamicObject component = transform.GetChild(i).GetComponent <DynamicObject>(); if (null != component) { component.m_parent = this; component.BuildHierarchy(); m_children.Add(component); } } }
private void BuildDynamicObjectsHierarchy(Transform t) { int childCount = t.get_childCount(); for (int i = 0; i < childCount; i++) { Transform child = t.GetChild(i); DynamicObject component = child.GetComponent <DynamicObject>(); if (null != component) { component.BuildHierarchy(); m_rootDynamicChildren.Add(component); } else { BuildDynamicObjectsHierarchy(child); } } }