Presumably because the player is too far away to get a closest node defined, then when the enemy AI tries to get a targetNode there is nothing there. I'm guessing this is because of the maxDist in GetClosestNodeTo not reaching the player properly. Perhaps a default node can be assigned in this case, we don't want the game to crash if this occurs even if the player would have died in such a situation.
Error message is: NullReferenceException: Object reference not set to an instance of an object
EnemyAI.UpdatePathNew () (at Assets/Scripts/Enemy/EnemyAI.cs:137)
I'll try to fix it, but I'm not super familiar with the code so we'll see if I can do it...
Presumably because the player is too far away to get a closest node defined, then when the enemy AI tries to get a targetNode there is nothing there. I'm guessing this is because of the
maxDist
inGetClosestNodeTo
not reaching the player properly. Perhaps a default node can be assigned in this case, we don't want the game to crash if this occurs even if the player would have died in such a situation.Error message is: NullReferenceException: Object reference not set to an instance of an object EnemyAI.UpdatePathNew () (at Assets/Scripts/Enemy/EnemyAI.cs:137)
I'll try to fix it, but I'm not super familiar with the code so we'll see if I can do it...