- A* version: 5.3.4
- Unity version: 2022.3
3D First Person game: Player moves via forces and fixedUpdate. Carries a Box. Box has a Navmesh Cut Component with default setting (not changing for rotation etc) so Npc’s avoid walking into the Box. Typically after carrying the box for about 30-60sec the game will crash:
System.IndexOutOfRangeException:
This Exception was thrown from a job compiled with Burst, which has limited exception support. Turn off burst (Jobs → Burst → Enable Compilation) to inspect full exceptions & stacktraces. In this standalone build configuration burst will now abort the Application.
Crash!!!
It often crashes at the same “locations” on the Recast graph. Removing the Navmesh Cut results in no more crashes.
Of note I do get: Degenerate triangles might have been generated.
Usually this is not a problem, but if you have a static level, try to modify the graph settings slightly to avoid this edge case.
When Scanning the Recast Graph for the Terrain in my Scene.
Oh that’s not very lovely
What version of 2022.3 are you using? If you’re on an older one I’d start there. I’d also check the version of the Burst package you’re running. As for the Degenerate triangles error, are you able to isolate that to a specific area/navmesh cut?
Hi
This is a newly introduced bug that will be fixed in the next update. Sorry about that.
No worries thanks for letting me know!
Good evening. I am still having the same issue after the update:
Hi
Can you reliably replicate that error?
Correct. Just attach a NavMeshCut component to any object and walk around with it happens within about 1 min or quicker if you walk in front of NPC’s (using FollowerEntity).
Of note:
- I rescanned and have no degenerate triangles in the scan.
- I do load in saved graphs, but their scans/graphs when view in runtime appear to be correct (not rescanning and causing degenerates).
- I have noticed the larger I make the NavCutMesh area the less likely it is to happen.
Here are my scan setting in case something obvious sticks out.
Thank you!
Here is my Method for loading in graphs in case that is being done wrong:
private void LoadAllGraphs()
{
var data = AstarPath.active.data;
data.cacheStartup = false;
AstarPath.active.scanOnStartup = false;
data.ClearGraphs();
Debug.Log("[Astar_MultiGraphLoader] Cleared existing graph.");
if (graphCacheFile == null)
{
Debug.LogWarning("[Astar_MultiGraphLoader] No graph cache file assigned");
return;
}
data.DeserializeGraphs(graphCacheFile.bytes);
Debug.Log($"[Astar_MultiGraphLoader] Loaded graph cache: {graphCacheFile.name}");
}
That’s excellent.
Would it be possible for you to share a project that allows us to replicate the issue?
I think your particular setup is important.
Well I’m a liar. I was in the wrong Scene when I said I did NOT have Degenerates. So this issue seems to be a direct result of using the NavCut with degenerates.
It was not possible for me to avoid degenerates with Recast Graphs, as I have floors with varying widths between the planks and mesh colliders are used for the flooring to allow items to pass through.
I have now switched over to using a LayerGridGraph and using the GraphBlock to accomplish the same thing.
private IEnumerator MonitorMovement()
{
while (true)
{
yield return new WaitForSeconds(checkInterval);
if ((transform.position - _lastPosition).sqrMagnitude > positionThreshold * positionThreshold)
{
ApplyGraphBlock();
_lastPosition = transform.position;
}
}
}
private void ApplyGraphBlock()
{
// Graph Walkable
if (_graphUpdateObject != null)
{
var previousGUO = new GraphUpdateObject(_graphUpdateObject.bounds)
{
modifyWalkability = true,
setWalkability = true
};
AstarPath.active.UpdateGraphs(previousGUO);
}
// Create a new because using old doesn't work and results in error
var bounds = _triggerCollider.bounds;
_graphUpdateObject = new GraphUpdateObject(bounds)
{
modifyWalkability = true,
setWalkability = false
};
AstarPath.active.UpdateGraphs(_graphUpdateObject);
}
Have not had any issues…other than wishing every building was oriented to the same axis to align cleanly with the gridgraph lol.
Not sure if that helps at all, let me know if you need anything else or if that answers the “why” for the crash.
Hi
I don’t think the degenerates should be relevant here, as they are just stripped away from the graph.
Would it be possible for you to share a project that allows us to replicate the issue?