using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GetComponent : MonoBehaviour
{
    public Transform[] transforms;

    void Start()
    {
        transforms = GetComponentsInChildren<Transform>(true);
    }
}
GetComponentsInChildren<Transform>(true);//游戏对象下的子物体激活的没激活的都会被拿到,包括游戏对象本身
GetComponentsInChildren<Transform>(false);//游戏对象下的子物体激活的会被拿到,包括游戏对象本身;没激活的不会被拿到
另外,()不写的活默认为false.

 
                    
            
                

相关文章:

  • 2021-08-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-12
  • 2021-12-17
  • 2022-01-02
  • 2022-02-07
猜你喜欢
  • 2022-12-23
  • 2021-05-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
  • 2021-09-10
相关资源
相似解决方案