When setting a destination and following normal pathfinding (whilst the recast graph is updating) the object with RichAI behaves correctly and no errors are produced, but when I use teleport it throws the below error and jumps around the map as they find a position that is acceptable to walk on.
NullReferenceException: Object reference not set to an instance of an object
Pathfinding.TriangleMeshNode.GetVertices (Pathfinding.Int3& v0, Pathfinding.Int3& v1, Pathfinding.Int3& v2) (at Library/PackageCache/com.arongranberg.astar@4.3.40/Generators/NodeClasses/TriangleMeshNode.cs:97)
Pathfinding.TriangleMeshNode.ClosestPointOnNode (UnityEngine.Vector3 p) (at Library/PackageCache/com.arongranberg.astar@4.3.40/Generators/NodeClasses/TriangleMeshNode.cs:129)
Pathfinding.BBTree.SearchBoxClosest (System.Int32 boxi, UnityEngine.Vector3 p, System.Single& closestSqrDist, Pathfinding.NNConstraint constraint, Pathfinding.NNInfoInternal& nnInfo) (at Library/PackageCache/com.arongranberg.astar@4.3.40/Generators/Utilities/BBTree.cs:358)
Pathfinding.BBTree.QueryClosest (UnityEngine.Vector3 p, Pathfinding.NNConstraint constraint, System.Single& distance, Pathfinding.NNInfoInternal previous) (at Library/PackageCache/com.arongranberg.astar@4.3.40/Generators/Utilities/BBTree.cs:343)
Pathfinding.NavmeshBase.GetNearestForce (UnityEngine.Vector3 position, Pathfinding.NNConstraint constraint) (at Library/PackageCache/com.arongranberg.astar@4.3.40/Generators/NavmeshBase.cs:504)
Pathfinding.NavmeshBase.GetNearest (UnityEngine.Vector3 position, Pathfinding.NNConstraint constraint, Pathfinding.GraphNode hint) (at Library/PackageCache/com.arongranberg.astar@4.3.40/Generators/NavmeshBase.cs:456)
Pathfinding.NavGraph.GetNearest (UnityEngine.Vector3 position, Pathfinding.NNConstraint constraint) (at Library/PackageCache/com.arongranberg.astar@4.3.40/Generators/Base.cs:211)
AstarPath.GetNearest (UnityEngine.Vector3 position, Pathfinding.NNConstraint constraint, Pathfinding.GraphNode hint) (at Library/PackageCache/com.arongranberg.astar@4.3.40/Core/AstarPath.cs:2116)
AstarPath.GetNearest (UnityEngine.Vector3 position, Pathfinding.NNConstraint constraint) (at Library/PackageCache/com.arongranberg.astar@4.3.40/Core/AstarPath.cs:2081)
AstarPath.GetNearest (UnityEngine.Vector3 position) (at Library/PackageCache/com.arongranberg.astar@4.3.40/Core/AstarPath.cs:2049)
Pathfinding.RichAI.Teleport (UnityEngine.Vector3 newPosition, System.Boolean clearPath) (at Library/PackageCache/com.arongranberg.astar@4.3.40/Core/AI/RichAI.cs:243).
I use AstarPath.active.ScanAsync(); to rescan the map after the user places an item so it updates all the penalties etc. Areas which don’t need to be updated are unaffected and the characters teleports ok.
Am I missing something here i.e. do I need to check there isn’t an update being run before running teleport?
Unity Version: 2019.4.20f1 (also affects 2020.2.3f1)
Astar Version: 4.2.15 (also affects 4.3.40)