Support Forum

[Bug] NodeLink2

Hello @aron_granberg ,

I am getting this error:

NullReferenceException
UnityEngine.Transform.get_position () (at <c8dc2b468d1841099baa4dd8a110cc44>:0)
Pathfinding.NodeLink2.Apply (System.Boolean forceNewCheck) (at <e30b247c41064267bf8ee249f267966e>:0)
Pathfinding.NodeLink2.OnGraphsPostUpdateBeforeAreaRecalculation () (at <e30b247c41064267bf8ee249f267966e>:0)
Pathfinding.GraphModifier.TriggerEvent (Pathfinding.GraphModifier+EventType type) (at <e30b247c41064267bf8ee249f267966e>:0)
UnityEngine.Debug:LogException(Exception)
Pathfinding.GraphModifier:TriggerEvent(EventType)
Pathfinding.WorkItemProcessor:ProcessWorkItems(Boolean, Boolean)
Pathfinding.WorkItemProcessor:ProcessWorkItemsForUpdate(Boolean)
AstarPath:PerformBlockingActions(Boolean)
AstarPath:FlushWorkItems()
AstarPath:ShutdownPathfindingThreads()
AstarPath:OnDisable()

which happens when I load another level. I think you need to add a null check here:

public override void OnGraphsPostUpdateBeforeAreaRecalculation () {
			// If a graph has just been scanned then do a more thorough check for which nodes the link goes between
			Apply(AstarPath.active.isScanning);
		}