In my game, upon reaching the end of the level, I change scenes to go to the next level. Most of the stuff is maintained from scene to scene using DontDestroyOnLoad, but the environment(floor) is not. So, I tried creating a new level environment in the next scene and baking it, but when the player enters that scene by reaching the end of the previous level, I get a NavMesh error stating that SetDestination can only be called on active agents. Why does this happen? Does the player have to be in the scene when baking occurs? Right now, the player does not natively reside in the scene, but gets loaded to it.

Edit: I created a new project with just the bare essentials for testing and it works as intended. Clearly, something was off with my other code which caused this kind of interference.



When baking is complete, you will find a NavMesh asset file inside a folder with the same name as the scene the NavMesh belongs to. For example, if you have a scene called First Level in the Assets folder, the NavMesh will be at Assets > First Level > NavMesh.asset (for more).

You have to baked your floor in each scene separately, and load in each scene.

  • \$\begingroup\$ I did bake my floor in each scene, and I do see that NavMesh file in all of my scene directories. \$\endgroup\$ – embracethefuture Aug 24 '17 at 8:02
  • \$\begingroup\$ each scene has single nevmesh \$\endgroup\$ – Muhammad Faizan Khan Aug 24 '17 at 9:16

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