Hey, so I’m working with a procedural game, and trying to use the NavMeshPlus project’s solution, but the only tutorials I can find all do it with the UI - which just doesn’t work for me.
Instead, I’m trying to do something like this…
void init_navmesh()
{
NavMeshSurface2d nm_2d = NavMesh_2D.GetComponent();
nm_2d.defaultArea = 0;
nm_2d.layerMask = 256 + 512 ; // 256 = layer 8 = obstacle layer… 512 = layer 9 = floor layer
nm_2d.compressBounds = true;
nm_2d.collectObjects = CollectObjects2d.Children;
//nm_2d.useGeometry = NavMeshCollectGeometry.RenderMeshes;
nm_2d.useGeometry = NavMeshCollectGeometry.PhysicsColliders;
nm_2d.BuildNavMesh();
}
where layers 8 (the obstacle layer) has a ton of meshes in it which all have a navmeshmodifier set as below :
NavMeshModifier nvm = wall.AddComponent();
nvm.overrideArea = true;
nvm.area = 1;
where area = 1 means it’s unwalkwable.
layer 9 (the floor layer) is literally just a bunch of irregular hexagons, but they’re all part of the “walkable section.”
Anyways. Nothing works, it’s like it doesn’t even build the navmesh at all, and I don’t see any progress for like 2 days now. Driving me up the wall.