So right now Im having a event that when triggered, should add that collided object into a List of the object holding the trigger. However, later when i call a function to try and use this List its saying my list.count is 0. really confused why this is happening, please help.
//PathNode Class
public List<GameObject> linkedNodes;
void Start ()
{
linkedNodes = new List<GameObject>();
}
public void setMoverStart()
{
Debug.Log(this.linkedNodes.Count);//Gives me 0
}
public void OnTriggerEnter(Collider col)
{
if (col.gameObject.tag == "NODE")
{
if (col.gameObject != null)
{
this.linkedNodes.Add(col.gameObject);
}
}
}
// AIGen Class
private GameObject spawnNode;
void Update()
{
spawnNode.GetComponent<PathNode>().setMoverStart();
}