We are experiencing some trouble with NavMeshes. We are developing a 2D sprite-based sidescrolling game, and we can’t generate any NavMesh only with the colliders of the sprites, we have to add physical 3D meshed objecs in order to get the NavMesh created. However, this is absurd since we do not need any 3D modelled object or ground in a sprite game.
I ran into this issue today and came up with an answer. It works, so I am very happy. I create cubes where I want the navmesh, or add a mesh renderer to the colliders I have and set them to a transparent material so that I can tell when it is on or off. I then threw them all in an empty gameobject just to keep them together, and then baked the navmesh. When that was done, I disabled the mesh renderers - they went away leaving the navmesh - and colliders - intact.
You can create this with meshes. You should add the script like the following to the objects that you don’t wanna see after game starts:
class SomeScriptName
{
void Awake()
{
gameObject.SetActive(false);
}
};
Now you can bake you navMesh. The mesh will not change while the objects are enabled. After game starts your objects dissables and you dont have it on your scene.
After you press stop objects will be enabled and you can modify it if you want
(Another on advice: don’t make them fully static. Just mark as walkable with NavMesh window. Disabling static object can cause big overhead)
My way of solving this is instead of setting the object to transparent material, I set it to invisible using custom invisible shader. That way you can enable the mesh renderer and you will not see the object.