Created
June 11, 2015 07:40
-
-
Save arun02139/30df7a9eb2ad0c96ec38 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
public static GameObject FindRecursive(this GameObject o, string target_name) | |
{ | |
if(o.name == target_name) | |
return o; | |
int numChildren = o.transform.childCount; | |
for (int i = 0; i < numChildren; ++i) | |
{ | |
GameObject tRet = o.transform.GetChild(i).gameObject.FindRecursive(target_name); | |
if(tRet != null) | |
return tRet; | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment