Floodfill vs Scan

Hi,

This is probably a stupid question. But what is the difference between
AstarPath.active.Scan();
and
AstarPath.active.FloodFill();?

the documents arn’t very specific.
Scan: Scans all graphs.

Floodfill: Floodfills all graphs and updates areas for every node.

I know scan also updates the information in the nodes.

Also I don’t know which would be better for performance and why?
I want to know because I am using AstarPath.active.UpdateGraphs(collider bounds) to add an object, which from what I read just updates the nodes around that collider?

If that is in fact what AstarPath.active.UpdateGraphs() is doing then what would be the equivalent to removing an object and updating the nodes it occupied?

Thanks in advance,

Vunpac

Hi

FloodFill:
When a path is requested, it is first checked if such a path is actually possible. The reason is that if it was not possible, but the script would try to find it anyway, it would end up searching the whole graph, which would be very slow. So flood filling pre-calculates “areas” of the graph. An area is a connected component (see wikipedia ).
FloodFill is called from Scan.

Scan:
Completely recalculates the graphs, creating and destrying nodes, positioning them and everything else.

UpdateGraphs:
Updates a small number of nodes. What it updates can differ depending on settings, but usually you want to call it when you have added or removed an object from some position and you want to recalculate the graph just around that point.
This will also need to call FloodFill, which tends to be the slowest part of the update actually. But it is still a lot faster than a full scan.

I see, makes sense. I thank you for your prompt response!