Error: This part should never be reached

Hi @aron_granberg

So I’ve recently started to receive the following error:

AssertionException: Assertion failure. Value was True
Expected: False
IndexOutOfRangeException: Index was outside the bounds of the array
Unhandled exception during pathfinding. Terminating
Error : This part should never be reached.

I’m not sure how to debug this, as I’m not yet able to reproduce the issue.

I’m using a grid graph with the procedural grid mover script. An important note is that my game uses a chunk system similar to that of Minecraft. Whenever chunk loading has ended I scan the graph manually, as the procedural grid mover sometimes makes the grid be ahead of the chunk loading causing holes in the navigation as the procedural grid mover does not scan the same areas twice, hence me scanning manually after chunk loading to prevent these holes. Other than that I’m using the ready made AILerp script.

My current version of the asset is 4.3.64. I tried updating, but this caused my pathfinding to not work at all anymore, even though the grid was displayed correctly. I use the seeker to determine if a path is possible or not before making the player walk, but using the ‘Seeker.StartPath’ in combination with ‘path.WaitForPath()’, always makes ‘path.error’ return true.

If there is any I can provide to you to figure this out, let me know.

Cheers

That seems strange. Do you have any more details?

I’d rather focus on the issue of the error message, I’ve also already discarded the update so can’t give you more detail on that either. How could I go about debugging said error message?

Hi

4.3.64 is quite old, so there’s a high probability that this has been fixed in an update. That’s why I’m more interested in getting the upgrade to work.
To debug the exception, you’d need to include a more detailed stack-trace.

1 Like

Ok, I updated again to provide you with some more details:

What I do in the very beginning is to generate the world, than I spawn the player and an interesting thing I have to do is set the destination of the “AIDestinationSetter” to the location the player is standing on, like the follwoing:

// Need to search the path once, otherwise pathfinding does not work the first time around
destination.target = target.transform;
movement.SearchPath();

Keep in mind that this worked in Version 4.3.64, whereas it does not in 4.3.82. It could be of importance that the “Seeker” is standing above the target, i.e. the X and Z is the same, but the Y is different. This does not seem to be a problem tho, as the start and end point of the path are on the same Y. Error-wise wise I only get the warning of the path having failed with a computation time of XYZ and some searched nodes.

My usual movement works inside of a coroutine, where I first get the current path from the Seeker, then start a path search between the player and the selected target, wait for the path to finish, and then execute my movement depending on the path being successful or not.

Not sure what more I can give you in terms of useful details, but here is my graph conifguration.

Odd.

What error does the path fail with?

It’s just the following warning:

Path Failed : Computation Time 2,001 ms Searched Nodes 1502
Error: Searched all reachable nodes, but could not find target. This can happen if you have nodes with a different tag blocking the way to the goal. You can enable path.calculatePartial to handle that case as a workaround (though this comes with a performance cost).
Path Number 34 (unique id)
UnityEngine.Debug:LogWarning (object)
AstarPath:LogPathResults (Pathfinding.Path) (at ./Library/PackageCache/com.arongranberg.astar@4.3.82/Core/AstarPath.cs:829)
AstarPath:<.ctor>b__80_2 (Pathfinding.Path) (at ./Library/PackageCache/com.arongranberg.astar@4.3.82/Core/AstarPath.cs:632)
Pathfinding.PathProcessor:CalculatePathsThreaded (Pathfinding.PathHandler) (at ./Library/PackageCache/com.arongranberg.astar@4.3.82/Core/Pathfinding/PathProcessor.cs:366)
Pathfinding.PathProcessor/<>c__DisplayClass26_0:b__0 () (at ./Library/PackageCache/com.arongranberg.astar@4.3.82/Core/Pathfinding/PathProcessor.cs:121)
System.Threading.ThreadHelper:ThreadStart ()

€: Looking through the change log now to see if anything might have messed with my previous approach, I’ve done this previously and didn’t find anything, but maybe I’ll spot something now.

Do you have any off-mesh links in your scene? Or do you use any tags?

Do you think you could post a screenshot of the graph when you have A* Inspector → Settings → Debug → Graph Color set to Areas.

All tags are set to default and the graph looks like the following.

image

Hi

Hmm. I cannot see anything strange there. The agent should be able to navigate anywhere in the teal-colored region.
Would it be possible for you to share your project with me? I cannot see any reason why you would get that path error message with the setup you have mentioned.

Can’t really do that unfortunately.

I’ll now be going from 4.3.64 to the newest one update for update, so I could at least tell you where it stops working.

Ok so the pathfinding stops working with version 4.3.67.

Hmm. Well, that is right when I did a big rework of how paths worked. So it’s not unreasonable that this would be the culprit. Though I haven’t managed to replicate anything similar. To double-check, it is the exact same error message that you get?

One question. Do you have multiple graphs? It looks like I can see the edge of one in the screenshot?

It’s the same message as before, i.e. the warning that the path has failed.

I’m using just one graph with the procedural grid mover script, the edge you see is because my graph is smaller than the world I’m loading.

Can you narrow down if your custom scans or the procedural grid mover is causing some issues? What happens if you disable both, and just scan the graph at the start of the game?

Alright so here’s the results:

  • Just turning off the Procedural Grid Mover did not change anything.
  • Turning off all my custom scans and scanning manually by pressing the scan button did not change anything.

€: Maybe this might be of relevance. At the start of the game I scan the graph via ‘AstarPath.active.ScanAsycn()’ to ensure that I can wait for it before executing any more code. Later in the game tho I had to start using (i.e. whenever chunk loading was finished) ‘AstarPath.active.data.gridGraph.Scan()’, I’m not entirely sure why, but the usual ‘AstarPath.active.ScanAsync()’ did not do the trick anymore.

Very strange
The only remaining unusal feature that you use is the Per Layer Modifications custom grid graph rule. Does that affect anything?

I turned off the Per Layer Modifications feature, but that unfortunately did not change anything either. I’ve edited my previous post with some additional information, which might be relevant.

Could you post your exact code for scanning the graph?

I’ll do that in a bit in the meantime here is the error that occurs for me in the 4.3.64 version with a more detailed log.

Error.txt (33.8 KB)