原文链接:https://blog.csdn.net/ChinarCSDN/article/details/80878900
查询所有失活的子孙物体
using UnityEngine; /// <summary> /// 查找物体 /// </summary> public class ChinarFindObject : MonoBehaviour { private void Start() { //遍历所有物体:GetComponentsInChildren<Transform>(true)返回一个 Transform[] 数组 //括号中,加上true。会将被关闭掉的物体也返回到数组中 foreach (var t in GetComponentsInChildren<Transform>(true)) { print(t.name); } } }