NavMeshComponents causing many errors when building game.

I have NavMeshComponents imported into my project. I am only using a NavMeshSurface with multiple nav meshes that are separate from each other. I also have a nav mesh agent that is attached to an enemy prefab that is spawned multiple times throughout the level, and makes use of the setDestination() method. When I play the game in the editor I get no errors and the nav mesh agent stays within the bounds of the nav mesh it is placed on and uses setDestination() to find the player as I intended. However, when I try to build the game, I get a wall of error messages from the NavMeshComponents scripts. I’m still new to Unity, so if anyone can point me in the right direction it would be a big help.

I could not reproduce this with Unity 2021.1.6f1 and AI Navigation 1.0.0-exp.4. The error messages look like there are broken references to other pieces of code.

Try

  • deleting the Library folder, which will cause Unity to rebuild it. Sometimes, files are corrupted and can cause errors like this; deleting the Library folder would fix such an issue.
  • updating Unity to a newer version, or re-adding the NavMeshComponents package to have the newest verion of that.