I am using a custom point graph, where I add nodes and their connections manually.
Later on, when I need to remove some nodes, I create a new work item and flag them as destroyed:
_astarPath.AddWorkItem(new AstarWorkItem(ctx =>
{
graphNode.Destroy();
}));
This causes strange behaviour - the rest of the calling method doesn’t finish, so my game stays in a corrupt state.
I tried commenting out the call to .Destroy() method, and everything worked perfectly fine (except for the fact that nodes weren’t destroyed).
What am I doing wrong? Do I need to call destroy from somewhere else?