Unity中激活子物体

void GetChildrenAndSetActive()
    {
        Transform[] imageTargetObjects = GetComponentsInChildren<Transform>();
        //注意:index=0的时候获取的是它自身,因此遍历要从1开始
        for (int index = 1; index < imageTargetObjects.Length; index++)
        {
            imageTargetObjects[index].gameObject.SetActive(true);
            Debug.Log(imageTargetObjects[index].name);
        }
    }
原文地址:https://www.cnblogs.com/ezhar/p/12918096.html