Hi, sorry I neglected to check back in here. I actually implemented something very similar at the code location you stated.
childCount only counts the immediate children of the parent, though, so that will work fine as long as the hierarchy isn't too complex. I added this instead, and it seems to work without any obvious issues:
I'm presuming GetChild and GetComponentsInChildren don't differ too much in terms of performance.
Thanks for getting back to me!
childCount only counts the immediate children of the parent, though, so that will work fine as long as the hierarchy isn't too complex. I added this instead, and it seems to work without any obvious issues:
Code:
Transform[] ts = res.GetComponentsInChildren<Transform>(true);
foreach (Transform t in ts)
t.gameObject.layer = Layer;
I'm presuming GetChild and GetComponentsInChildren don't differ too much in terms of performance.
Thanks for getting back to me!