You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
736 B
33 lines
736 B
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
|
|
public class GetAreaTargetManager : MonoBehaviour |
|
{ |
|
public static GetAreaTargetManager Instance; |
|
[SerializeField] |
|
private List<Transform> children; |
|
private void Awake() |
|
{ |
|
children = new List<Transform>(); |
|
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; |
|
} |
|
}
|
|
|