How to scan new obstacles through script?

I’m using the grid graph.

I have been looking for the proper way to re scan or catch a new (prefab generated) obstacles in my script.

I have setup a testing scene with a button that moves an obstacle up and down in the Y axis; initially (on awake) it starts by colliding with the ground and A* detects it as an obstacle correctly; but when the button moves it up and places it back A* is not recognizing anything.

I’m only calling the AstarPath.Scan() function, am I missing something?

Well, it appears that if I delay the scan a bit it works. A* won’t recognize it if I scan immediately after I place the obstacle.

It worked for me using unity’s Invoke function:
`
var delayTime : float = 0.0001f;

Invoke(“Scan”, delayTime);
`