using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Serialization; public class ChallengeMatchSceneUIRegion : MonoBehaviour { public List posTran; public List posTranRect; public Transform myself; public RectTransform myselfRect; public string myJumpAudioName; public string followerJumpAudioName; public string fallAudioName; private void Reset() { Init(); } //private void Awake() //{ //} void Init() { myself = transform.Find("myself"); var re = transform.Find("myself (1)"); if (re) { myselfRect = re.GetComponent(); } int count = transform.childCount; Transform pos; Transform posRect; for (int i = 1; i < count; i++) { pos = transform.Find(i.ToString()); posRect = transform.Find(i.ToString() + " (1)"); if (posRect != null) { posTranRect.Add(posRect.GetComponent()); } if (pos != null) { posTran.Add(pos); } else { break; } } } }