Component[] componments2 = gameObject.GetComponents<Component>();
        Debug.Log("componments2的长度:" + componments2.Length);
        for (int i = 0; i < componments2.Length; i++)
        {
            Debug.Log("组件的名字:" + componments2[i]);
//componments2[i] 是拿到组件的名字, componments2[i].name是拿到组件所在的游戏对象的名字
        }

Unity GetComponents获取组件

Unity GetComponents获取组件Unity GetComponents获取组件

相关文章:

  • 2022-12-23
  • 2021-07-21
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案