Find all nodes in a rectangular range

Hey Aron,

I’m trying to find all pathnodes on a grid graph within a rectangular range. I know that GetReachableNodes (or a Constant Path) will get me all nodes within a radius from a start node, but I can’t think of how to adjust the code to get all grid graph nodes within a rectangular space. Is this something that’s possible?

Right now the only solution I can think of would be to put a box collider in my scene and then run through every single node on the grid graph checking if Collider.Bounds.Contains is true, but that seems very clunky/brute force.

Thanks!

Whelp, I just found GetNodesInArea which does the trick nicely.

2 Likes