NullReferenceException when I destroy NavmeshCut GameObject

Hey,

I am using NavmeshCuts on Wall in my RTS Game. When en enemy destroys a wall, I execute:

        AstarPath.active.navmeshUpdates.ForceUpdate();
        AstarPath.active.FlushGraphUpdates();

After that I recalculate the Paths of the enemies. But as soon as one Wall (with a NavmeshCut) gets destroyed I get dozens of:

I dont really know why this is the case, since I am not really changing the navmesh. :confused:

PS: Can I use Heuristic Optimization with NavmeshCuts? Besides these, I have a static RecastGraph, that never needs to be scanned.

Ty for the help :slight_smile:

Update:

I found out that in the Methods SharedEdge and GetPortal of the NavmeshTriangleNode-Class the NullPointer is occurung, the Member connections is null. I only have that when I use NavMeshCuts on my Graph and the enemies destroy an obstacle (which is a NavmeshCut). When I only tried to move the NavmeshCuts instead of destroying, the Exception got still thrown.

Could anybody help me? I dont get why a Node should have connections with null :confused:

Hi

Thank you for reporting this. I think this has already been fixed in a beta version. The connections member may be null if the node has no connections. Until the non-beta version with this fix is released you should be able to work around it by adding a check in the SharedEdge method to check for null.