Created
September 14, 2017 07:44
-
-
Save valentincognito/bb068f0135a2d5edf740ffb6b9613406 to your computer and use it in GitHub Desktop.
Get the index of the first active child
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
private int GetFirstActiveindex(GameObject _parentObject) | |
{ | |
for (int i = 0; i < _parentObject.transform.childCount; i++) | |
{ | |
if (_parentObject.transform.GetChild(i).gameObject.activeSelf == true) return i; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment