Beta - Navmeshcut and Nodelink Issues After Replaying

Simple scene with one two way NodeLink2 and one NavmeshCut. Everything works fine on the first play.

Move or disable/enable the NavmeshCut and things still ok. Stop play and then start again and error results. More play/stop and problem the same. Guessing maybe something is getting serialized wrong or a rogue thread.

If NavmeshCut is not moved or disabled then no problems stopping and playing again.

Running a manual scan seems to clear this up for one run. (Or closing the project).

Latest Beta and not using cached, scan on awake enabled.

NullReferenceException: Object reference not set to an instance of an object
Pathfinding.AstarData.AddGraph (System.Type type) (at Assets/AstarPathfindingProject/Core/AstarData.cs:564)
Pathfinding.NodeLink2.CreateLinkNodes () (at Assets/AstarPathfindingProject/Core/Misc/NodeLink2.cs:83)
Pathfinding.NodeLink2.Apply (System.Boolean forceNewCheck) (at Assets/AstarPathfindingProject/Core/Misc/NodeLink2.cs:196)
Pathfinding.NodeLink2.OnGraphsPostUpdateBeforeAreaRecalculation () (at Assets/AstarPathfindingProject/Core/Misc/NodeLink2.cs:73)
Pathfinding.GraphModifier.TriggerEvent (Pathfinding.GraphModifier+EventType type) (at Assets/AstarPathfindingProject/Core/Misc/GraphModifier.cs:91)
UnityEngine.Debug:LogException(Exception)
Pathfinding.GraphModifier:TriggerEvent(EventType) (at Assets/AstarPathfindingProject/Core/Misc/GraphModifier.cs:101)
Pathfinding.WorkItemProcessor:ProcessWorkItems(Boolean, Boolean) (at Assets/AstarPathfindingProject/Core/Misc/WorkItemProcessor.cs:322)
Pathfinding.WorkItemProcessor:ProcessWorkItemsForUpdate(Boolean) (at Assets/AstarPathfindingProject/Core/Misc/WorkItemProcessor.cs:375)
AstarPath:PerformBlockingActions(Boolean) (at Assets/AstarPathfindingProject/Core/AstarPath.cs:884)
AstarPath:FlushWorkItems() (at Assets/AstarPathfindingProject/Core/AstarPath.cs:1146)
AstarPath:AddWorkItem(AstarWorkItem) (at Assets/AstarPathfindingProject/Core/AstarPath.cs:993)
AstarPath:AddWorkItem(Action`1) (at Assets/AstarPathfindingProject/Core/AstarPath.cs:951)
Pathfinding.NodeLink2:OnDisable() (at Assets/AstarPathfindingProject/Core/Misc/NodeLink2.cs:149)

Hi

Which exact version are you using?

Version 4.3.8. Errors also appear when I stop play and load a new scene. I am guessing callbacks to Nodelink2.OnDisable() not getting cleaned up at right time.

On a side note, original issues I had with links and navmeshcuts in the official release are fixed. So for the first play things are working great.

Hi

Thanks!
I managed to replicate this and fix the issue.
The fix will be included in the next release.

Updated to version 4.3.9. Original error seems fixed but I am getting some new errors now.

Starting a project fresh, I receive the following error on play.

NullReferenceException: Object reference not set to an instance of an object
Pathfinding.NavmeshUpdates.ForceUpdateAround (Pathfinding.NavmeshClipper clipper) (at Assets/Standard Assets/AstarPathfindingProject/Navmesh/NavmeshUpdates.cs:151)
Pathfinding.NavmeshCut.ForceUpdate () (at Assets/Standard Assets/AstarPathfindingProject/Navmesh/NavmeshCut.cs:243)
Pathfinding.NavmeshUpdates.HandleOnEnableCallback (Pathfinding.NavmeshClipper obj) (at Assets/Standard Assets/AstarPathfindingProject/Navmesh/NavmeshUpdates.cs:172)

When play is stopped, I receive two errors:

ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <437ba245d8404784b9fbab9b439ac908>:0)
Pathfinding.NavmeshClipper.OnDisable () (at Assets/Standard Assets/AstarPathfindingProject/Navmesh/NavmeshCut.cs:47)

MissingReferenceException: The object of type ‘Transform’ has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Transform.get_position () (at :0)
Pathfinding.NodeLink2.Apply (System.Boolean forceNewCheck) (at Assets/Standard Assets/AstarPathfindingProject/Core/Misc/NodeLink2.cs:222)
Pathfinding.NodeLink2.OnGraphsPostUpdateBeforeAreaRecalculation () (at Assets/Standard Assets/AstarPathfindingProject/Core/Misc/NodeLink2.cs:74)
Pathfinding.GraphModifier.TriggerEvent (Pathfinding.GraphModifier+EventType type) (at Assets/Standard Assets/AstarPathfindingProject/Core/Misc/GraphModifier.cs:91)
UnityEngine.Debug:LogException(Exception)
Pathfinding.GraphModifier:TriggerEvent(EventType) (at Assets/Standard Assets/AstarPathfindingProject/Core/Misc/GraphModifier.cs:101)
Pathfinding.WorkItemProcessor:ProcessWorkItems(Boolean, Boolean) (at Assets/Standard Assets/AstarPathfindingProject/Core/Misc/WorkItemProcessor.cs:322)
Pathfinding.WorkItemProcessor:ProcessWorkItemsForUpdate(Boolean) (at Assets/Standard Assets/AstarPathfindingProject/Core/Misc/WorkItemProcessor.cs:375)
AstarPath:PerformBlockingActions(Boolean) (at Assets/Standard Assets/AstarPathfindingProject/Core/AstarPath.cs:883)
AstarPath:FlushWorkItems() (at Assets/Standard Assets/AstarPathfindingProject/Core/AstarPath.cs:1145)
AstarPath:OnDestroy() (at Assets/Standard Assets/AstarPathfindingProject/Core/AstarPath.cs:1409)

I am testing with a single NavmeshCut in the scene. If I remove that, then no errors are produced.

Hi

I could not replicate those errors, however I think I have fixed a potential bug by just looking at the stacktraces you provided. I will include the fix in the next beta.

Looking good in Beta 4.3.10. Thank you.

1 Like