Quantcast
Channel: Latest Questions by khoatic
Viewing all articles
Browse latest Browse all 97

List not storing objects

$
0
0
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 linkedNodes; void Start () { linkedNodes = new List(); } 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().setMoverStart(); }

Viewing all articles
Browse latest Browse all 97

Trending Articles