Failed to create agent because there is no valid NavMesh

Hello. Can anyone tell me what I getting this error ?

This error is on my enemy.

2 Likes

Try this,
For loading the scene.
Application.LoadLevelAsync(“levelName”);

or

Make sure the game level is properly baked.

or
Try deleting the enemy, import it again and add the nav mesh agent freshly.

4 Likes

Failed to create agent because there is no valid NavMesh

Can someone help me with this?
I already put it in my inspector

“Hello. Can anyone tell me what I getting this error ?”

The technical answer is, because your GameObject with the NavMeshAgent component isn’t in contact with a NavMesh. That answer is about as helpful as referring someone to the docs. (you know who you are)

Long story short, you need these things:

  1. A NavMesh.
    You bake these in your Terrain.
    (Click on the GameObject Terrain, and look in the Navigation tab which isn’t viewable by default.)
  2. A NavMeshAgent, which you clearly have, because it’s generating the error.
    Make sure the NavMeshAgent is touching the NavMesh when your game starts.
    (IF it’s touching, and you’re still getting the error, try waiting a second or two before enabling this GameObject. I’ve had this fix issues for me in the past. Seems like the NavMesh takes a little longer to establish itself than the NavMeshAgent. Then it’s dogs, and cats living together.)
8 Likes

Give this a read.

https://docs.unity3d.com/Manual/nav-BuildingNavMesh.html

3 Likes

Ok, I know late. I am learning unity and had the same problem following this and believe it or not the answer was just setting y = the ground/terrain’s y, or for me 1. Hope that helps any people that see this!

I had the same problem just make 100% sure ur terrain / ground is baked

1 Like

I’m getting the same error, I don’t know exactly what to do though, like line it up with the ground?!?

add a “nav mesh surface” in the object

I don’t know if it will help. but after trying every of those possible solutions wich are useful in most of cases, i have discovered that, due how i got my scene wich i got a main scene with the character and a second scene on the same scene but unloaded wich got different navmesh “floor” and I dont know why but settit my main scene as “set active scene” it fixed it. Hope it could help. for more info my character touching the main scene navmesh “floor” wich i set as active scene