Recalculate grid from Aron Granbergs A*?

I am currently checking out Aron Granbergs A* library and completed his tutorial. The scene consists of a plane with 1 box (obstacle) and a movable unit. Everything works as expected. Now have I seen in the Clicker.cs script some lines which allow by pressing “r” to remove objects tagged as “DynamicObject” and then the grid should be recalculated. The purpose of this is being able to place/remove buildings for strategy games.

I did press “r” during runtime on the box - which got removed - but afterwards the grid wasn’t calculated again. A debug message opens (no error though) and: “Flood Filled 118 Nodes, The Grid now contains 2 Areas”. However the hole is still in the grid and doesn’t allow the character to pass through. Any ideas whats wrong?

Ok. I progressed a bit: while being in playmode I could press on the A* script in the Hierarchy outline and click the button “Scan Map” again. The grid was calculated correctly again with no holes anymore. Is there a function in the API (didn’t find it) to do this “Scan Map” during runtime with a script?

Edit: ok, found it in the AstarPath script. AstarPath.active.Scan(true,1) worked.

Edit: ok, the above rescan is not the correct way to do it, better doing: StartCoroutine (AstarPath.active.SetNodes (true,hit.collider.bounds,true,0.1F));
Although this is already written into the code it didn’t work. It works however when you call this function afterwards.