public Transform[] grandFa;
public List<GameObject> animObs = new List<GameObject>();
public int indexAnim = 0;
// Use this for initialization
void Start()
{
grandFa = GetComponentsInChildren<Transform>();//打到所有的子孙子物体
//get all objects of having animator, that is there is no child
foreach (Transform child in grandFa)
{//找到最下一层的子节点,以及子节点上有动画的物体
if (child.childCount == 0 && child.gameObject.GetComponent<Animator>())
{
animObs.Add(child.gameObject);
child.gameObject.GetComponent<Animator>().enabled = false;
}
}
}