Created
March 30, 2020 06:58
-
-
Save korchoon/c8db25067e30721e713328230b62d3d1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public static Transform FindInChildren(this Transform self, string name) | |
{ | |
int count = self.childCount; | |
for (int i = 0; i < count; i++) | |
{ | |
Transform child = self.GetChild(i); | |
if (child.name == name) return child; | |
Transform subChild = child.FindInChildren(name); | |
if (subChild != null) return subChild; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment