Hi there,
I have set up a gridgraph with the following settings:
I Instantiate a cube prefab and assign a random position to it every 1 second, and consider it an unwalkable part of the graph.
private void Refresh()
{
_obj.SetActive(false);
var bounds = _obj.GetComponent<Collider>().bounds;
var guo = new GraphUpdateObject(bounds);
guo.updatePhysics = true;
AstarPath.active.UpdateGraphs(guo);
_obj.SetActive(true);
_obj.transform.position = new Vector3(Random.Range(0, 10f), 0f, -Random.Range(0, 10f));
bounds = _obj.GetComponent<Collider>().bounds;
guo = new GraphUpdateObject(bounds);
guo.updatePhysics = true;
AstarPath.active.UpdateGraphs(guo);
}
I expect the first part of the code to remove the previous position of the cube on the graph, and the second part, add a unwalkable hole on the graph.
Unfortunately the result I get is multiple holes that represent the change done during the previous refresh… No holes get cleared up.
Is this process not synchronous? is it due to multithreading?