MultiTargetPath changelog

Hello
I’m try to update to the latest version from 4.3.83, In this changelog below you mentioned that the MultiTargetPath got modified, I’ve maintained a custom MultiTargetPath myself thus I’d like to know what part of code you changed to fix this problem.

4.3.85 (2023-12-07)

  • Fixed MultiTargetPath could throw an exception if calculatePartial was enabled.
commit 9cded5c7a52138cb795f07b489eaf54ce745b2f3
Author: Aron Granberg <aron.granberg@gmail.com>
Date:   Tue Dec 5 14:05:49 2023 +0100

    Fixed MultiTargetPath could throw an exception if MultiTargetPath.calculatePartial was enabled.

diff --git a/Assets/AstarPathfindingProject/Pathfinders/ABPath.cs b/Assets/AstarPathfindingProject/Pathfinders/ABPath.cs
index d0da5438f..d66f27ae3 100644
--- a/Assets/AstarPathfindingProject/Pathfinders/ABPath.cs
+++ b/Assets/AstarPathfindingProject/Pathfinders/ABPath.cs
@@ -49,11 +49,7 @@ namespace Pathfinding {
 		 * Set by different path types.
 		 * \since Added in 3.0.8.3
 		 */
-		protected virtual bool hasEndPoint {
-			get {
-				return true;
-			}
-		}
+		protected virtual bool hasEndPoint => true;
 
 		/** Calculate partial path if the target node cannot be reached.
 		 * If the target node cannot be reached, the node which was closest (given by heuristic) will be chosen as target node
@@ -405,7 +401,8 @@ namespace Pathfinding {
 
 		void CompletePartial () {
 			CompleteState = PathCompleteState.Partial;
-			endPoint = endNode.ClosestPointOnNode(originalEndPoint);
+			endPoint = pathHandler.GetNode(partialBestTargetPathNodeIndex).ClosestPointOnNode(originalEndPoint);
 			cost = partialBestTargetGScore;
 			Trace(partialBestTargetPathNodeIndex);
 		}
diff --git a/Assets/AstarPathfindingProject/changelog.cs b/Assets/AstarPathfindingProject/changelog.cs
index 24f3d9ab8..1ef46a4e5 100644
--- a/Assets/AstarPathfindingProject/changelog.cs
+++ b/Assets/AstarPathfindingProject/changelog.cs
@@ -7,6 +7,7 @@
 	- Added \reflink{GraphMask.FromGraphIndex}.
 	- Added support for rendering gizmos while the scene view is in wireframe mode. This is supported on Unity 2023.1 and up.
 	- Fixed a memory leak that could happen if the AstarPath component was put in a prefab.
+	- Fixed \reflink{MultiTargetPath} could throw an exception if \reflink{MultiTargetPath.calculatePartial} was enabled.
 	- Fixed an exception being thrown if the scene contained some \reflink{FollowerEntity} components that had gravity enabled, and some that had gravity disabled.
 	- Fixed a rare exception that could be thrown when the AIPath or RichAI components were drawing gizmos.
 	- Pathfinding would not work in WebGL builds (regression in 4.3.83).

This is the full diff. Note that the changes are made in the ABPath script, so you most likely don’t need to change anything in your MultiTargetPath variant.

1 Like