private void spawnAgent() { Vector3 spawnPos = GameObject.FindGameObjectWithTag("Spawn").transform.position; Quaternion rotate = GameObject.FindGameObjectWithTag("Spawn").transform.rotation; GameObject npc = Instantiate(SpawnList[0], spawnPos, rotate) as GameObject; AgentData tempData = new AgentData(); Debug.Log ("ID from npc : " + npc.GetInstanceID()); tempData.setID(npc.GetInstanceID()); Debug.Log ("ID from data : " + tempData.getID()); tempData.setOtherAgents(findOtherAgents()); Debug.Log ("OtherAgents : " + tempData.getOtherAgents()); Debug.Log ("Name from npc : " + npc.name); tempData.setInitial(npc.name); Debug.Log ("Name from data : " + tempData.getInitial()); npc.GetComponent<Sentry>().setAgentData(tempData); Debug.Log (npc.GetComponent<Sentry>().getAgentData().getInitial()); History.Add(tempData); //if (History[agentAttempts] == null) Debug.Log (agentAttempts + " was null"); //Debug.Log ("History ID : " + History[agentAttempts].getInitial()); //Debug.Log ("History: " + History.Count()); agentAttempts++; SpawnList.RemoveAt(0); Debug.Log ("After SpawnList Remove"); setWaypointsForNPCs(); }