Hi, I’ve been having a nightmare trying to get this script sorted out and it’s slowly going in the right direction, but when I try and solve the path, for some reason I get the following error:
NullReferenceException: Object reference not set to an instance of an object
AStarSolver.GetNodeWithLowestTotal (System.Collections.Generic.List`1 list) (at Assets/Scripts/AStarSolver.cs:126)
AStarSolver.Solve (Vector3 startPos, Vector3 endPos) (at Assets/Scripts/AStarSolver.cs:52)
DrawPaths.Update () (at Assets/Scripts/DrawPaths.cs:24)
I know that this means I’m trying to access something that hasn’t been set, but I don’t know why this is.
I’d appreciate it if someone could read it and tell me what’s up with it.
using UnityEngine;using System.Collections;using System.Collections.Generic; - Pastebin.com the pathfinder.
EDIT: I also want to point out that the grid is generated before anything else is ran, and it still errors out.
An index?
– luckruns0utyou so fast. yeah, an index: for ( int i = 0; i < list.Count; i++ ) { openNode = list*;*
– LoiusDidn't know that was called an index :P Thought that was just called a for loop
– luckruns0ut