原文链接: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);
        }
    }
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-16
  • 2021-08-30
  • 2022-12-23
  • 2021-07-28
  • 2022-02-25
  • 2022-12-23
相关资源
相似解决方案