- Home /
Unity 5.4.2.f2 new ERROR msg - A passive NavMeshAgent is expected to have no path. But this one has 2 polygons
Just upgrade to Unity and getting this error message:
"A passive NavMeshAgent is expected to have no path. But this one has 2 polygons."
There is no extra info or line of code or anything:
What does it mean? How do I fix it?
I have also been getting same error in the Unity3d beta v5.5.0b11
Its such a strange error. I tried a couple of things. It does not make it go away and the AI behaves strangely because of this error I think.
What you wrote is a comment, not an answer to the actual question. Can you remove/change it please?
Happens to me as well from 5.4.2. AI runs in circles, ragdolls fly into the air. Only seems to happen if object with nav mesh is at Y position less than 0.
What you wrote is a comment, not an answer to the actual question. Can you remove/change it please?
Answer by RuneSP · Nov 16, 2016 at 10:55 PM
I've been getting this error lately as well. In my case it seemed to happen because my enemy character with the Nav Mesh Agent and an Animator component was being moved by the animators animation (root motion), without the nav mesh agent having a destination.
Either disabling the root motion or making sure the character has a destination whenever an animation was moving it, seemed to solve it.
After this I continued to get the error on clients in multiplayer. This was due to the destination only getting set on the server, creating a ClientRPC function to set the nav mesh agent destination on the clients as well, solved it.
Wow!! Thanks a lot, it is indeed the root motion which makes that error.
I was having a lot of trouble trying to figure out the source of this issue. But now, it makes sense. Thanks again.
I think you nailed the problem but I can't figure out a solution in my specific case. I can't disable the root motion, so how can I "$$anonymous$$ake sure the character has a destination whenever an animation is moving it"?
Using the setDestination method on the Nav$$anonymous$$eshAgent. As long as the character is in an idle animation, its not a problem if it doesnt have a destination (as its not moving). But whenever the character is a an animation that moves it and it doesnt have a destination set by the setDestination method, the error will occur.
I don't think that is the actual problem even though the SetDestination is a possible solution. In my case, I don't want/need to SetDestination() since I don't need a new path while the actor is being moved and it feels messy to have to define one. I have a feeling it's related to using any navmesh function that expects a path (e.g. ResetPath()) when there is none but I can't nail the actual problem.
An absolutely excellent description of the actual problem, with a clear solution -- way to go RuneSP!! #twoThumbsUp :D
Thanks, this was my problem too! I use root motion to move things and use the NavmeshAgent's steeringTarget as a destination to move towards. In order to keep the agent's pathing up to date I manually update the agent's nextPosition, however doing that when there is no path causes this problem so all I have to do is only move it when there is a path.
Answer by castor · Dec 13, 2016 at 07:17 PM
So I found what was the issue in my case, and just like both of yours, it's a unique situation that the damn LogWarning is very very much lacking in detail.
I had a NavMeshCarve surface on the floor and one of my agents was on top of it. The new NavmeshCarve behaviour has changed and EVEN if the carving is disabled, the agent will be pushed away from it. This meant that my agent since he was on top of this carved mesh was automatically setting a new destination and path to get away from the mesh. This was causing the error since I manually control all the navmesh agent movement and wasn't allowing him to move.
To properly understand WHEN the error happens in my project, I added the following:
//Do this when the agent is supposed to be disabled
if (playerProperties.actorAgent.hasPath) {
Debug.LogError(transform.name + " - Agent is assigning himself a new path!");
}
In my case, I have certain behaviors that move my NPCs around without using the nav mesh agent, and sometimes they go into areas without nav mesh. Even though my nav mesh agent was stopped and had no path, it was doing as you said.
The answer for me was simply to ensure I completely disable the nav mesh agent when I am not using it for navigation. This keeps it from interfering with my other behaviors that are moving the character.