GraphUpdateScene difficulties in 2D

I’m creating a 2D scene (using XY rather than XZ) using grid, and I’d like to be able to destroy objects and update the available path nodes accordingly.

Right now, here’s what I’m doing:

  • Before the GameObject is destroyed, I change its layer so that it’s no longer within one of the Masked layers that pathfinding pays attention to.
  • Next, I run GetComponent().Apply ();
  • Then, I destroy the object.

This doesn’t entirely work. As you can see in the following images, new nodes are added after the object is destroyed, but there are still some missing nodes.
http://imgur.com/a/KRT9l

Am I using the correct method here? Or could this be an XY vs XZ issue?

Also just to note, I tried using AstarPath.active.UpdateGraphs(bounds); which worked but caused a noticeable frame rate hitch.

I was able to fix this issue by making some modifications to GraphUpdateScene.cs

To fix, change the references to “collider” to “collider2D”.

Then, there 3 identical lines dealing with bounds that need to be changed. This is what mine looks like:
/if (b.size.y < minBoundsHeight)/ b.size = new Vector3(b.size.x,b.size.y,0);

I just got rid of the minBoundsHeight check here since I have no use for it. Works perfectly now.