Navmesh & Probuilder

Probuilder generates a dynamic mesh with it’s editing features. how can i use it’s mesh with Pathfinding Navmesh feature? Pathfinding allows static(saved to file) meshes. i cannot drag&drop Probuilder GameObject to use it’s mesh.

Hi

You will need to use a script for that.
`
// at top of script
using Pathfinding;


Mesh mesh = // get ProBuilder mesh

// Get navmesh graph
NavMeshGraph graph = AstarPath.active.astarData.navmeshGraph;
graph.sourceMesh = mesh;

// Scan graphs
AstarPath.active.Scan ();
`

i assumed that it accepts an mesh object and uses it’s calculated Navmesh. i have unity pro and bake my navmesh. can i use this baked navmesh with pathfinding?

Hi

Yes, the navmesh graph accepts a mesh object and calculates a navmesh from that.
The equivalent of baking a navmesh in unity pro is done using the RecastGraph in the pro version of the A* Pathfinding Project.

You cannot use the mesh baked using Unity Pro navmesh right now, but it is relatively easy to build a Mesh object by using the NavMesh.CalculateTriangulation function (Unity Pro) and then pass that to a navmesh graph as in the code in the previous answer.