Error "Another async scan is already running"


#1

Hi there!

I’m running into this issue “Another async scan is already running” and I can’t figure out how to work around it.
When this happens it looks like the how scanning logic breaks and the AI wont use the graph generated any more.

To reproduce the issue I am getting, I have two chunks of blocks(100x100 for example) next to each other and when the player changes from one block to the other, I scan the surface of the block I just entered using the ScanAsync function.

So if I change back to the other block I scan this other one.

Everything works fine until I move back and forth between these two blocks. If I do this quick enough I get the error mentioned above.

Any help will be appreciated! Thank you in advance.


#2

Hi

That means you are trying to scan the graph asynchronously before the previous scan completed.
Maybe you want to use more local graph updates instead? See https://arongranberg.com/astar/docs/graph-updates.php that will be a lot faster too.


#3

Thanks for the quick reply!

Local graph updates does scan faster that is great! But is there a way of discarding the previous navmesh generated?
For example in the 100x100 example I said before, when I called the ScanAsync funtion I also moved the bounds to the same size as the block I was entering. Therefor only that navmesh was generated (which is the desired result).

Now I have made the graph bounds as big as both blocks and every time a switch from block to block I do a local graph update as you said. It works great but is there a way of discarding the navmesh outside the bounds I set when calling the UpdateGraphs function (so that there is no navmesh on the block I came from)?


#4

Ah, I see. I misread your original question.
An local graph update will not be faster in this case because you have to recalculate the whole graph.
However when you start your async scan, you should make sure the previous one is completed before you start the new one.

Alternatively you could check out the ProceduralGridMover component which does pretty much this out of the box. Check out the example scene called ‘Procedural’.


#5

Ah! Checking if the scan is completed did the trick!

Thank you very much!