Created
October 16, 2019 03:34
-
-
Save sergiobd/45455b2e9c361723cbf763134face317 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Utility function for looping (deeply) through all children in a transform | |
Usage: | |
List<Transform> childs = new List<Transform>(); | |
Utilities.GetAllChildren(queryParent.transform, ref childs); | |
*/ | |
static class Utilities | |
{ | |
public static void GetAllChildren(Transform parent, ref List <Transform> transforms) | |
{ | |
foreach (Transform t in parent) { | |
transforms.Add(t); | |
GetAllChildren(t, ref transforms); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A script for getting all childs (including grandchilds and further), from a parent transform. Unity.