1
\$\begingroup\$

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.

\$\endgroup\$

closed as off-topic by DMGregory Oct 2 '18 at 16:59

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about debugging a problem must provide a minimal, complete, verifiable example of the issue so that readers can diagnose it without needing to guess, read all of your code, or engage in extensive back-and-forth dialog. For more information, see this meta thread." – DMGregory
If this question can be reworded to fit the rules in the help center, please edit the question.

0
\$\begingroup\$

Because

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.

\$\endgroup\$
  • \$\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.