"Diagonal Connections not Supported"

  • A* version: 5.4.3
  • Unity version: 6000.0.56f1

When units are navigating a GridGraph, I keep getting an Exception: Diagonal connections are not supported

This does not happen immediately when the units spawn, it only happens a little bit into them navigating the grid. Full stack trace is posted below.

It happens when there’s a couple units on the grid. I’ve made a screen recording below

What does this error mean? I understand if it’s some misconfiguration, but why does it then only pop up when there are many units?

Exception: Diagonal connections are not supported
  at Pathfinding.PathTracer.ResolveNormalizedGridPoint (Pathfinding.GridGraph grid, Pathfinding.Collections.CircularBuffer`1[Pathfinding.GraphNode]& nodes, Pathfinding.Collections.UnsafeSpan`1[T] cornerIndices, Pathfinding.Funnel+PathPart part, System.Int32 index, System.Int32& nodeIndex) [0x0017b] in ./Library/PackageCache/com.arongranberg.astar@9a6b1e585a1a/Utilities/PathTracer.cs:1837 
  at Pathfinding.PathTracer.SimplifyGridInnerVertex (Pathfinding.Collections.CircularBuffer`1[Pathfinding.GraphNode]& nodes, Pathfinding.Collections.UnsafeSpan`1[T] cornerIndices, Pathfinding.Funnel+PathPart part, Pathfinding.Collections.CircularBuffer`1[System.Byte]& portalIsNotInnerCorner, System.Collections.Generic.List`1[T] alternativePath, System.Int32& alternativeStartIndex, System.Int32& alternativeEndIndex, Pathfinding.TraversalConstraint& traversalConstraint, Pathfinding.TraversalCosts& traversalCosts, System.Boolean lastCorner) [0x00174] in ./Library/PackageCache/com.arongranberg.astar@9a6b1e585a1a/Utilities/PathTracer.cs:1900 
  at Pathfinding.PathTracer.GetNextCornerIndices (Unity.Collections.NativeArray`1[System.Int32]& buffer, System.Int32 maxCorners, Unity.Collections.Allocator allocator, System.Boolean allowSimplify, System.Boolean& lastCorner) [0x00122] in ./Library/PackageCache/com.arongranberg.astar@9a6b1e585a1a/Utilities/PathTracer.cs:1490 
  at 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.EnabledRefRW`1[T] readyToTraverseOffMeshLink, Pathfinding.ECS.ManagedState managedState, Pathfinding.ECS.MovementSettings& settings, Unity.Collections.NativeList`1[T] nextCornersScratch, Unity.Collections.NativeArray`1[System.Int32]& indicesScratch, Unity.Collections.Allocator allocator, System.Boolean onlyApplyPendingPaths) [0x00102] in ./Library/PackageCache/com.arongranberg.astar@9a6b1e585a1a/Core/ECS/Jobs/JobRepairPath.cs:188 
  at Pathfinding.ECS.JobRepairPath.Execute (Unity.Entities.ArchetypeChunk& chunk, System.Int32 unfilteredChunkIndex, System.Boolean useEnabledMask, Unity.Burst.Intrinsics.v128& chunkEnabledMask) [0x0011e] in ./Library/PackageCache/com.arongranberg.astar@9a6b1e585a1a/Core/ECS/Jobs/JobRepairPath.cs:127 
  at Pathfinding.ECS.JobRepairPath.Unity.Entities.IJobChunk.Execute (Unity.Entities.ArchetypeChunk& chunk, System.Int32 unfilteredChunkIndex, System.Boolean useEnabledMask, Unity.Burst.Intrinsics.v128& chunkEnabledMask) <0x4708a3288 + 0x0005b> in <2aad84f142c446d29831a2af1b8b21fe>:0 
  at Unity.Entities.JobChunkExtensions+JobChunkProducer`1[T].ExecuteInternal (Unity.Entities.JobChunkExtensions+JobChunkWrapper`1[T]& jobWrapper, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) [0x0013f] in ./Library/PackageCache/com.unity.entities@6a355619334f/Unity.Entities/IJobChunk.cs:420 
  at Unity.Entities.JobChunkExtensions+JobChunkProducer`1[T].Execute (Unity.Entities.JobChunkExtensions+JobChunkWrapper`1[T]& jobWrapper, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) [0x00001] in ./Library/PackageCache/com.unity.entities@6a355619334f/Unity.Entities/IJobChunk.cs:363

[EDIT] I tried downgrading back to 5.3.8 but now I’m getting Exception: Run more migrations than there are migrations to run. Finished: 4000000F all: 40000007

[EDIT2], I reverted all of my prefabs/assets (using git) to the versions before updating to 5.4, which fixed the migrations error. Also, on A* 5.3.8, I don’t get the “diagonal connections” error.

Regression maybe? Has your entities version changed at all? Or does it have an update? I’ll tag @aron_granberg here since it didn’t exist before but did after updating.

That’s expected when downgrading. Reverting them using git is the proper solution.

Can you post your grid settings?

Do you have any way to reliably replicate the issue?

It happens all the time (on A* 5.4) .

But that’s in my project, I haven’t set up a clean repro.
(I would be willing to share the project with you though, if you’re interested)

Settings below:

Just curious. Does the NotBuildable tag affect the movement of agents?

Do you have any other tags that affect the movement of agents?

I’m having this same issue. Isometric Grid with Dimetric angle & 0.1 grid size. It happens after pathing around for a bit quite randomly, I can’t figure out how to trigger it every time.

I don’t have any tags at all.

@noio @pesukarhu can you both post your current versions for the Mathematics, Entities, Burst, and Collections packages? Another thread was having a similar issue and I want to see if dependencies may be related.

Mathematics: 1.3.3
Entities: 1.4.3
Burst: 1.8.25
Collections: 2.6.3

1 Like

Hello, is there any update on the issue?

It’s still on the plate :+1: If you find any additional info you think would help be sure to post it here

1 Like

Yeah, it’s an issue I will prioritize fixing properly in the near future. But it’s a tricky one. Might take a bit of time.

You can work around it by setting Connections = Four in the grid graph settings. But that might not work for many games (and it changes paths quite a bit).

1 Like

Exception: Diagonal connections are not supported
Pathfinding.PathTracer.ResolveNormalizedGridPoint (Pathfinding.GridGraph grid, Pathfinding.Collections.CircularBuffer1[Pathfinding.GraphNode]& nodes, Pathfinding.Collections.UnsafeSpan1[T] cornerIndices, Pathfinding.Funnel+PathPart part, System.Int32 index, System.Int32& nodeIndex) (at ./Packages/com.arongranberg.astar/Utilities/PathTracer.cs:1846)
Pathfinding.PathTracer.SimplifyGridInnerVertex (Pathfinding.Collections.CircularBuffer1[Pathfinding.GraphNode]& nodes, Pathfinding.Collections.UnsafeSpan1[T] cornerIndices, Pathfinding.Funnel+PathPart part, Pathfinding.Collections.CircularBuffer1[System.Byte]& portalIsNotInnerCorner, System.Collections.Generic.List1[T] alternativePath, System.Int32& alternativeStartIndex, System.Int32& alternativeEndIndex, Pathfinding.TraversalConstraint& traversalConstraint, Pathfinding.TraversalCosts& traversalCosts, System.Boolean lastCorner) (at ./Packages/com.arongranberg.astar/Utilities/PathTracer.cs:1902)
Pathfinding.PathTracer.GetNextCornerIndices (Unity.Collections.NativeArray1[System.Int32]& buffer, System.Int32 maxCorners, Unity.Collections.Allocator allocator, System.Boolean allowSimplify, System.Boolean& lastCorner) (at ./Packages/com.arongranberg.astar/Utilities/PathTracer.cs:1493) 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:188)
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) (at :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@42c4e852ffb4/Unity.Entities/IJobChunk.cs:421)
Unity.Entities.JobChunkExtensions+JobChunkProducer1[T].Execute (Unity.Entities.JobChunkExtensions+JobChunkWrapper1[T]& jobWrapper, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at ./Library/PackageCache/com.unity.entities@42c4e852ffb4/Unity.Entities/IJobChunk.cs:364)

I’m having the same issue, I just recently bought the asset and only have a basic setup. No Optimizations. Also happens after a while of pathing around an agent. Should we downgrade to a previous version?

Unity 6000.0.59f2

Mathematics 1.3.2

Entities 1.4.3

Burst 1.8.25

Collections 2.6.3

I’d try this workaround if you haven’t yet/are able to.

Otherwise if you want to downgrade I’d just take note of the warnings mentioned by Aron as well as the edit posted by OP.

Ok, setting Connections to Four seems to work for now, I haven’t seen how much of a negative effect it has yet on path calculation. I’m going to keep watching this thread for any updates.

1 Like

Hi

I found another tricky bug relating to this. I’ll include a fix in the next update.

The fix is quite simple, though. So as a workaround, until the next update, you can comment out the following lines in GridGraph.cs:

// Only allow taking a diagonal move if we have at least 2 steps remaining
nextNode = remainingSteps > 1 ? fromNode.GetNeighbourAlongDirection(ndir) : null;
if (nextNode != null && (nextNode == prevNode || !traversalConstraint.CanTraverse(fromNode, nextNode))) nextNode = null;

// Taking a diagonal takes us one additional step closer to the target node compared to an axis-aligned move.
if (nextNode != null) remainingSteps--;
2 Likes

Thanks, I can’t update the file currently, since it’s read-only (unity package folder). “Connections = Four” does also fix it for now, I haven’t seen any negative side effects so far. Looking forward to the next update though!