Pathfinding: Exception: Axis-aligned connection not found

I’m on the latest 5.3.8 and get the error below.

This is the same error as this Error Exception: Axis-aligned connection not found on A*PathFinding version 5.2.4 - #7 by aminere

I’m on Unity 6.2 (6000.2.4f1).
collections 2.5.7
burst 1.8.24
entities 1.3.14

I don’t do anything special, just a bunch of FollowerEntity that move using SetDestination on a GridGraph.

Exception: Axis-aligned connection not found
Pathfinding.PathTracer.RemoveGridPathDiagonals (Pathfinding.Funnel+PathPart parts, System.Int32 partIndex, Pathfinding.Collections.CircularBuffer1[Pathfinding.GraphNode]& path, Pathfinding.Collections.CircularBuffer1[System.Int32]& pathNodeHashes, Pathfinding.NNConstraint nnConstraint, Pathfinding.ITraversalProvider traversalProvider, Pathfinding.Path pathObject) (at ./Packages/com.arongranberg.astar/Utilities/PathTracer.cs:1909)
Pathfinding.PathTracer.LocalSearch (Pathfinding.GraphNode currentNode, UnityEngine.Vector3 point, System.Int32 maxNodesToSearch, Pathfinding.Util.NativeMovementPlane movementPlane, System.Boolean reverse, Pathfinding.ITraversalProvider traversalProvider, Pathfinding.Path path) (at ./Packages/com.arongranberg.astar/Utilities/PathTracer.cs:1114)
Pathfinding.PathTracer.RepairFull (UnityEngine.Vector3 point, System.Boolean isStart, Pathfinding.PathTracer+RepairQuality quality, Pathfinding.Util.NativeMovementPlane movementPlane, Pathfinding.ITraversalProvider traversalProvider, Pathfinding.Path path) (at ./Packages/com.arongranberg.astar/Utilities/PathTracer.cs:852)
Pathfinding.PathTracer.Repair (UnityEngine.Vector3 point, System.Boolean isStart, Pathfinding.PathTracer+RepairQuality quality, Pathfinding.Util.NativeMovementPlane movementPlane, Pathfinding.ITraversalProvider traversalProvider, Pathfinding.Path path, System.Boolean allowCache) (at ./Packages/com.arongranberg.astar/Utilities/PathTracer.cs:659)
Pathfinding.PathTracer.UpdateEnd (UnityEngine.Vector3 position, Pathfinding.PathTracer+RepairQuality quality, Pathfinding.Util.NativeMovementPlane movementPlane, Pathfinding.ITraversalProvider traversalProvider, Pathfinding.Path path) (at ./Packages/com.arongranberg.astar/Utilities/PathTracer.cs:327)
Pathfinding.ECS.JobRepairPath.Execute (Unity.Transforms.LocalTransform& transform, Pathfinding.ECS.MovementState& state, Pathfinding.ECS.AgentCylinderShape& shape, Pathfinding.ECS.AgentMovementPlane& movementPlane, Pathfinding.ECS.AutoRepathPolicy& autoRepathPolicy, Pathfinding.ECS.DestinationPoint& destination, Unity.Entities.EnabledRefRW1[T] readyToTraverseOffMeshLink, Pathfinding.ECS.ManagedState managedState, Pathfinding.ECS.MovementSettings& settings, Unity.Collections.NativeList1[T] nextCornersScratch, Unity.Collections.NativeArray1[System.Int32]& indicesScratch, Unity.Collections.Allocator allocator, System.Boolean onlyApplyPendingPaths) (at ./Packages/com.arongranberg.astar/Core/ECS/Jobs/JobRepairPath.cs:173) Pathfinding.ECS.JobRepairPath.Execute (Unity.Entities.ArchetypeChunk& chunk, System.Int32 unfilteredChunkIndex, System.Boolean useEnabledMask, Unity.Burst.Intrinsics.v128& chunkEnabledMask) (at ./Packages/com.arongranberg.astar/Core/ECS/Jobs/JobRepairPath.cs:127) Pathfinding.ECS.JobRepairPath.Unity.Entities.IJobChunk.Execute (Unity.Entities.ArchetypeChunk& chunk, System.Int32 unfilteredChunkIndex, System.Boolean useEnabledMask, Unity.Burst.Intrinsics.v128& chunkEnabledMask) <0x11fc6ca2ff0 + 0x00072> in <b0b774f8b8564301a6b32259c9b44c29>:0 Unity.Entities.JobChunkExtensions+JobChunkProducer1[T].ExecuteInternal (Unity.Entities.JobChunkExtensions+JobChunkWrapper1[T]& jobWrapper, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/IJobChunk.cs:420) Unity.Entities.JobChunkExtensions+JobChunkProducer1[T].Execute (Unity.Entities.JobChunkExtensions+JobChunkWrapper`1[T]& jobWrapper, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at ./Library/PackageCache/com.unity.entities@e581b903be8e/Unity.Entities/IJobChunk.cs:363)

Thanks for new post/version info. Looking into it and this looks like a tricky one. Package versions look fine. Can you test this in a clean project and see if the issue persists?

I noticed that this happens a lot more often when giving orders to units to go to an unreachable grid cell. And it happens much more often after I upgraded to Unit 6.2

Normally, the units are supposed to move as close as possible to the unreachable cell and stop. I’m now wondering that the best way to fix this is to pre-calculate a valid position and use it to give the move order. If there is a best way in the library to give me the “nearest valid position” to any position, please let me know.

I have a simple grid graph and the units are moved using FollowerEntity.SetDestination

You can use NNConstraint (nearest node constraint) with AstarPath.GetNearest() to do exactly this.