Skip to content

Instantly share code, notes, and snippets.

@valentincognito
Created September 14, 2017 07:44
Show Gist options
  • Save valentincognito/bb068f0135a2d5edf740ffb6b9613406 to your computer and use it in GitHub Desktop.
Save valentincognito/bb068f0135a2d5edf740ffb6b9613406 to your computer and use it in GitHub Desktop.
Get the index of the first active child
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