public void AddAgent(Transform agentTrans) { NavmeshAgentController agent = agentTrans.GetComponent <NavmeshAgentController>(); if (agent) { agents.Add(agent); } }
public void RemoveAgent(Transform agentTrans) { NavmeshAgentController agent = agentTrans.GetComponent <NavmeshAgentController>(); if (agent) { agent.SetAgentActive(true); agent.transform.SetParent(null); agents.Remove(agent); } }