No AstarPath on scene END

Hello,

Testers have been playing my game and I get this nullreference VERY rarely. It seems to be when an agent in my scene toggles their own richAI script back on right before the game loads a new scene. Like I said this is very rare so it works 99% of the time.

I’ve gotten this error before but on scene load, because the apiath didn’t have an astarpath to look to. I’ve never gotten it on scene disable before.

NullReferenceException: No AstarPath object found in the scene. Make sure there is one or do not create paths in Awake
  at Pathfinding.Path.Reset () [0x0000d] in <d9255a87dfac4ea89c780336ba2e66a4>:0 
  at Pathfinding.ABPath.Reset () [0x00001] in <d9255a87dfac4ea89c780336ba2e66a4>:0 
  at Pathfinding.Path.Pathfinding.IPathInternals.Reset () [0x00001] in <d9255a87dfac4ea89c780336ba2e66a4>:0 
  at Pathfinding.PathPool.GetPath[T] () [0x000c8] in <d9255a87dfac4ea89c780336ba2e66a4>:0 
  at Pathfinding.ABPath.Construct (UnityEngine.Vector3 start, UnityEngine.Vector3 end, Pathfinding.OnPathDelegate callback) [0x00001] in <d9255a87dfac4ea89c780336ba2e66a4>:0 
  at Pathfinding.AIBase.SearchPath () [0x0003d] in <d9255a87dfac4ea89c780336ba2e66a4>:0 
  at Pathfinding.RichAI.SearchPath () [0x00017] in <d9255a87dfac4ea89c780336ba2e66a4>:0 
  at Pathfinding.AIBase.Init () [0x0003a] in <d9255a87dfac4ea89c780336ba2e66a4>:0 
  at Pathfinding.AIBase.OnEnable () [0x0001b] in <d9255a87dfac4ea89c780336ba2e66a4>:0 
UnityEngine.Behaviour:set_enabled(Behaviour, Boolean)
BobosWorld.BoboController_Navmesh:ToggleAIPath(Boolean)
BobosWorld.GardenBoboAITree:StopWaving()

just wanted to bump this

Hi

Looks like the AstarPath component is destroyed before your StopWaving call is made (which seems to enable an AIPath component).
Check the order of operations when your scene is destroyed. Or perhaps avoid calling some code when the scene is unloaded.