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.