• We are looking for a content creator to help market our assets and a future unannounced project. More details are on this page.

NavMeshAgentMovement Continues to Execute when Behavior is Disabled

magique

Active member
If a behavior is disabled with DisableBehavior, the NavMeshAgentMovement component is still executing. In my case, when we disable the behavior, we also disable to NavMeshAgent, but since this component is still executing, it gets navigation errors. I suppose if the NavMeshAgent is left enabled, it wouldn't do this, but it's necessary for our component to disable that so that when we re-use the instance from an object pool that it is off until we are ready to start the AI unit. I made the following changes to fix this and it would be a good change to add to the script to avoid future issues from other users:

There are 4 places to put a check to return if agent is disabled. In Update, ApplyPosition, and LateUpdate of NavMeshAgentMovement, put the following at the top of the function:

if (!m_NavMeshAgent.enabled) return;

And the following put at top of UpdateOffMeshLink function:

if (!m_NavMeshAgent.enabled) return false;
 
Last edited:

Justin

Administrator
Staff member
Thanks! I'll try out this change and let you know if I need any additional help reproducing the issue.
 
Top