Layered grid doesn't generate in caves

Hello!

I’m trying to generate a layered grid graph for caves, but it only makes one layer for the terrain. That layer only includes the highest possible surface, all surfaces below (in this case the caves) are ignored.
It works if surfaces are different objects, so it seems like it only generates one layer per object (the terrain is a single object).


Blue: Grid, Black: Terrain, White: Empty

Is there a way to generate multiple layers for one object, or another way to make the caves work?

Hi

This is an unfortunate limitation of Unity’s Physics.RaycastAll function. However, in the current beta version another approach is used which I think will bypass this limitation. You can try it out here: A* Pathfinding Project