Situation: I have an RTS with a grid graph. To check whether path still ok (area hasn’t been walled off), I am using node.Area. I cache the gridNodeBase for the destination then check its area vs. the open area (uint 1) every frame. This seems to work well, distinguishing walled off vs. not areas perfectly well… except when the graph updates. That is, placing or deleting a single wall, even if it should not change any area results in the .Area == 1 check to fail for a single frame. It doesn’t seem to fail every time for every agent, so it’s a bit strange. My overall goal is to cancel the agent’s behavior if and only if its path is now really invalid, so these semi-random failures aren’t reliable enough.
Idea to Fix: What I could do is count the number of frames it has failed in a row, and if too high then consider the path to be truly invalid.
Question: Is this the right approach? Is there a better solution? Why does it fail for just a frame?