using TMPro;
using UnityEngine;
public GameObject one;
public class Cards : MonoBehaviour
{
TMP_Text[] cardText = one.GetComponentsInChildren<TMP_Text>();
Debug.Log(TMP_Text.Length);
}
组件类型用TMP_Text搜索
本文介绍了如何在Unity中使用Cards类,通过TMP_Text组件搜索并获取其所有子元素,展示了对组件实例动态查找的技术。
using TMPro;
using UnityEngine;
public GameObject one;
public class Cards : MonoBehaviour
{
TMP_Text[] cardText = one.GetComponentsInChildren<TMP_Text>();
Debug.Log(TMP_Text.Length);
}
组件类型用TMP_Text搜索
1441
694

被折叠的 条评论
为什么被折叠?