0
\$\begingroup\$

I have differents environments (they are on the same position, and they are prefab) , each environment have differents obstacles.

The problem comes with the navMesh.

What I want is to have one navMesh for each environment and switch them at runtime

Example:

User choose Environment 1 ----> I switch to NavMesh 1 User choose Environment 2 ----> I switch to NavMesh 2

but every time I bake the navmesh it override the last one, also, How I can switch between navmesh?

Thanks in advance

\$\endgroup\$
1
\$\begingroup\$

I'd try to work around this using additive scene loading.

Create three different copies of your scene file. In each one, bake a navmesh for one corresponding version of your environment. Then delete the unneeded visual assets from these helper scenes, and remove navmesh from your main scene.

Now, at runtime, you can additively load or unload one of these helper scenes at a time to pull in just the navmesh variant you want.

If you have any common bits of navmesh in your main scene that need to connect to the others, you'll need to join them dynamically with off-mesh links as described here.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.