using System.Collections.Generic; using UnityEngine; public class PlayerInfo : MonoBehaviour { List<GameObject> friendlyBots = new List<GameObject>(); private void Start() { foreach (GameObject bot in GameObject.FindGameObjectsWithTag("Target")) { if (bot.GetComponent<Health>() && bot.GetComponent<AIMachine>()) friendlyBots.Add(bot); } friendlyBots.Remove(this.gameObject); } public List<GameObject> GetFriendliesList() { return friendlyBots; } }