Hi guys, just a quick question
Can you tell me what’s the best and efficient way to get gameobject children and also children of children from the parent with script?
Hi guys, just a quick question
Can you tell me what’s the best and efficient way to get gameobject children and also children of children from the parent with script?
for Child of Child you can call GetChild on the first children
If you don’t mind a list that’s potentially in an arbitrary order, you can
GetComponentsInChildren to get all transforms in a hierarchy
Check out the methods like ‘GetAllChildren()’ and ‘GetAllChildrenAndSelf’ in there. It’s towards the bottom.
@lordofduct is it okay if I use GameObjUtil? It has some pretty handy functionality in there =)
Yeah, that’s what it’s on there for.
All the code on that google code project is available for free on the MIT license.
http://opensource.org/licenses/mit-license.php
It’s the base of my spacepuppy framework, I have more code in my ‘spacepuppy extended’ framework that I’m working on releasing on the asset store.
thanks for the answers ![]()