MultiTargetPath exception after upgrading to 4.3.79

Prior to the upgrade (I am coming from 4.3.60) I was able to successfully request a MultiTargetPath with a lot of destinations. Now it seems that is prohibited. Is it or am I doing something wrong?

I am getting:

InvalidOperationException: Cannot create more than 512 temporary nodes
Pathfinding.PathHandler.AddTemporaryNode (Pathfinding.TemporaryNode node) (at ./Library/PackageCache/com.arongranberg.astar@4.3.79/Core/Pathfinding/PathHandler.cs:211)
Pathfinding.MultiTargetPath.Prepare () (at ./Library/PackageCache/com.arongranberg.astar@4.3.79/Pathfinders/MultiTargetPath.cs:326)
Pathfinding.Path.Pathfinding.IPathInternals.Prepare () (at ./Library/PackageCache/com.arongranberg.astar@4.3.79/Core/Pathfinding/Path.cs:1118)
Pathfinding.PathProcessor+<CalculatePaths>d__35.MoveNext () (at ./Library/PackageCache/com.arongranberg.astar@4.3.79/Core/Pathfinding/PathProcessor.cs:463)

I probably don’t have to say that It worked just fine and performant enough (in 4.30.60) for my case.

Help @aron_granberg
(this is simply a bump, hope it is allowed here)


Hmm. Yeah, this is a change I made. I didn’t expect people to be using it with more than 512 targets :stuck_out_tongue:
I’ll try to think of how to fix it.

1 Like

I really hope you will figure something out. I really don’t like using patched versions of external packages :slight_smile:
Do you mind sharing what problem this limit tries to solve? Why it was introduced?


I have uploaded a new version which allows you to raise the limit from the A* Inspector → Optimizations tab to 4096. It is due to a restructuring in how endpoints in multi target paths are handled. Previously it was pretty inaccurate (especially for recast graphs). Now it is more accurate, but it requires some extra memory per target, which has to be pre-allocated. I set the limit previously to 512 because I thought that ought to be high enough for everyone, obviously I was wrong :p. 4096, though?