/// <summary> /// Gathers the agents and assigns their agentinfo /// </summary> private void InitializeAgents() { GameObject[] agentObjs = GameObject.FindGameObjectsWithTag("Agent"); for (int i = 0; i < agentObjs.Length; i++) { Debug.Log("found agent"); GameObject agentObj = agentObjs[i]; Agent agent = agentObj.GetComponent <Agent>(); KnowledgeBase kb = agentObj.GetComponent <KnowledgeBase>(); kb.InitKnowledgeBase(); if (agent == null) { Debug.LogError("ERROR: No agent info component on gameobject tagged as agent NAME: " + agentObj.name); continue; } Debug.Log("valid agent"); agents.Add(agent); } for (int i = 1; i < agents.Count; i++) //i starting at one since the player should be the first agent added { Agent info = agents[i]; info.InitAgentInfo(i); } }