A* Pathfinding Project

Threading Issue? AI not pathing until debugger is connected or editor is clicked


I have a rather nasty intermittent issue that is popping up occasionally in 4.2.2. A few of the AIs will just stop moving. Their path is null and though they continue to search for a new path one is never returned. If I click an object in the editors Hierarchy or attach the debugger they again find a path and begin moving.

Using Grid Path planning.

Any thoughts?



Sorry for the late answer. I have been traveling and have not been able to answer support requests for some time.
That sounds strange. Can you find any errors in the log? Which movement script are you using?


Sorry responding with another account.

We have two issues, both that result in a path not being generated.

They are hard to repro. (We think) we fixed one in the single node blocker. It looks like maybe you are expecting people to destroy game objects rather then pooling them? In any case we remove node blockers when we pool an object. But a previously spun up thread could be latent and re-add a blocker after the object was pooled/removed. In InternalBlock we added this:
if (blocker.isActiveAndEnabled)

The other bug is much much nastier but harder to reproduce. It could be related to the above but we are unsure. I’ll post the message next time it happens. Its something about “Can’t find path to end node” but adding a breakpoint or clicking in the editor fixes the problem and the AI’s again find paths.


That sounds like some issue in your code rather than in the SingleNodeBlocker? If your thread calls methods on already pooled objects then that sounds bad.

Note sure about the other one. I don’t really have enough information to be able to debug it.