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 childforeach (Transform child in grandFa){//找到最下一层的子节点,以及子节点上有动画的物体if (child.childCount == 0 && child.gameObject.GetComponent<Animator>()){animObs.Add(child.gameObject);child.gameObject.GetComponent<Animator>().enabled = false;}}}
200字范文,内容丰富有趣,生活中的好帮手!