2D Pathfinding 'invert' collision mask?

I’m writing a 2D top-down simulation game where I have agents wandering around (and inside) a number of buildings.

The “outside” was pretty easy to do, I added all the buildings to a particular layer, attached some colliders, generated a grid graph and everything’s working great.

What I want to do now however is ensure that agents which are INSIDE a building can only pathfind from one room to the next and never step outside - essentially, I’d like to somehow create a new grid which inverts the Collision testing (ie - only allow agents to walk within building layer objects).

I’ve tried to set the mask to the ground but that just made everything non-accessable, I also tried unchecking ‘use 2D physics’ and playing around with height testing but that just made everything accessable (might be because I’m using 2D).

Am I missing something obvious here? Thanks

Hi

There is not currently a feature that does exactly that.
Do you happen to have wall colliders that you can mark as obstacles?
If not maybe you could do it using a GraphUpdateObject (see http://arongranberg.com/astar/docs/graph-updates.php and http://arongranberg.com/astar/docs/class_pathfinding_1_1_graph_update_scene.php).

Hmm, I guess I could put wall-colliders around the buildings and use that instead. Might even work out better than what I was planning on doing earlier as a transition between inside and outside.

Thank you very much