5.6 Runtime Navmesh and Agent Delayed Connection Issues

So, I’m working on a game in which the map is randomly generated each time it’s started. Just to give you an idea: The terrain is basically built up of multiple cuboids all positioned at -1 on the Y axis and at various points on the X and Z axes so it basically just makes a large flat area composed of tiles which allows me to have various resources randomly placed (or not) on them and allows me to have a fog of war system where each has its mesh renderer enabled as the player gets close to it. The player then starts at 0.6 on the Y axis (this just seemed to work best).

When I saw that 5.6 implemented NavMeshes that could be baked on runtime I thought it was great because it would solve my pathing issues. And I have got it to work, except for the fact that there seems to be an issue with the Agent connecting to the mesh. After the game starts, I get a message in the console saying “Failed to create agent because it is not close enough to the NavMesh.” If I wait a few minutes, the Agent seems to be shoved downward a little on the Y axis in a janky kind of way, at which point it seems to connect to the NavMesh and it works. But this is an issue because obviously it’s no good that it takes so long to kick in and also the agent being pushed down means it clips through the terrain. I tried playing around with the Agent component’s Base Offset parameter to see if that helped but it didn’t seem to make a difference. Anyone have any advice about what’s going wrong?

Thanks!

Try to setup the LocalNavMeshBuilder Area first in your scene and during runtime add NavMeshSourceTag to your dynamic generated content.

It might help to spawn your NPC with a delay.

Potentially all of the box colliders around each cube could be giving you some issues, I’ve noticed this making procedurally created games because tile by tile seems the easiest way at first. Try putting a plane over the top of the tiles where the floor would be to collide with them, your characters might float a smidge but it beats clipping.
Barring that, you could totally reconfigure your collision to work on a Raycast Overlap Sphere (Really only works if you’re moving transform.position manually each frame)