Timescale causing errors for RichAI

I have a player character that is attached to a RichAI script. Wherever I click on the ground the player character will walk over to that location. Pretty straight forward.

I also have a menu system that is activated when the player presses the “M” button. When the menu is shown, I’d like the game to pause. This is being done done using Time.timeScale = 0f; However, if the player character is walking, the RichAI script first freaks out sending the following error to my console:

ArgumentNullException: Value cannot be null.
Parameter name: key
System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
Pathfinding.RichFunnel.ClampToNavmeshInternal (UnityEngine.Vector3& position) (at Assets/3rdParty/AstarPathfindingProject/Core/AI/RichPath.cs:604)
Pathfinding.RichFunnel.ClampToNavmesh (UnityEngine.Vector3 position) (at Assets/3rdParty/AstarPathfindingProject/Core/AI/RichPath.cs:459)
Pathfinding.RichAI.ClampToNavmesh (UnityEngine.Vector3 position, System.Boolean& positionChanged) (at Assets/3rdParty/AstarPathfindingProject/Core/AI/RichAI.cs:458)
Pathfinding.AIBase.FinalizePosition (UnityEngine.Vector3 nextPosition) (at Assets/3rdParty/AstarPathfindingProject/Core/AI/AIBase.cs:621)
Pathfinding.AIBase.FinalizeMovement (UnityEngine.Vector3 nextPosition, UnityEngine.Quaternion nextRotation) (at Assets/3rdParty/AstarPathfindingProject/Core/AI/AIBase.cs:582)
Pathfinding.Examples.MecanimBridge.OnAnimatorMove () (at Assets/3rdParty/AstarPathfindingProject/ExampleScenes/Example3_Recast_Navmesh1/MecanimBridge.cs:139)

Then when the menu is unloaded and time.timeScale is set to 1f. My console is flooded with the following error:

NullReferenceException: Object reference not set to an instance of an object
Pathfinding.RichFunnel.ClampToNavmeshInternal (UnityEngine.Vector3& position) (at Assets/3rdParty/AstarPathfindingProject/Core/AI/RichPath.cs:586)
Pathfinding.RichFunnel.ClampToNavmesh (UnityEngine.Vector3 position) (at Assets/3rdParty/AstarPathfindingProject/Core/AI/RichPath.cs:459)
Pathfinding.RichAI.ClampToNavmesh (UnityEngine.Vector3 position, System.Boolean& positionChanged) (at Assets/3rdParty/AstarPathfindingProject/Core/AI/RichAI.cs:458)
Pathfinding.AIBase.FinalizePosition (UnityEngine.Vector3 nextPosition) (at Assets/3rdParty/AstarPathfindingProject/Core/AI/AIBase.cs:621)
Pathfinding.AIBase.FinalizeMovement (UnityEngine.Vector3 nextPosition, UnityEngine.Quaternion nextRotation) (at Assets/3rdParty/AstarPathfindingProject/Core/AI/AIBase.cs:582)
Pathfinding.Examples.MecanimBridge.OnAnimatorMove () (at Assets/3rdParty/AstarPathfindingProject/ExampleScenes/Example3_Recast_Navmesh1/MecanimBridge.cs:139)

And the ability to walk around is glitchy. Sometimes the player character stands in one place, walks in place, walks for a moment then stops, never reaching his destination, etc.

Is it possible this is a problem with MecanimBridge? I don’t see any other posts having this issue. Can anyone recommend a work around? Some way of “pausing” A* directly?

Thanks in advance!

Ah, I should mention, sometime ago I posted a bug on the forums and fixed in my own copy the fact that MechAnimBridge doesn’t appear to support RichAI, and that was fixed with the following code, you can see in the original post here:

Problem still persists, but it may have been my own fault for using the MechAnimBridge with RichAI to begin with? Any ideas welcome.