Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
void GetComponentsInChildrenRecursive<T> (Transform parent, List<T> buffer)
where T : Component
foreach (Transform t in parent) {
var c = t.GetComponent<T> ();
if (c) {
buffer.Add (c);
GetComponentsInChildrenRecursive (t, buffer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment