using System.Collections; using System.Collections.Generic; using UnityEngine; public class GetAreaTargetManager : MonoBehaviour { public static GetAreaTargetManager Instance; [SerializeField] private List children; private void Awake() { children = new List(); foreach (Transform item in transform) { children.Add(item); } Instance = this; } public Transform GetTarget(string name) { Transform result = null; foreach (var item in children) { if (item.name == name) { result = item; break; } } return result; } }