Agent Fails to See Player

I've built several scenes using agents that attack the player, but for some reason my latest one is not working.

Triage info:
  • The agent is using the default behavior tree
  • The agent has an assault rifle equipped by default
  • The agent has waypoints and correctly moves between them
  • The agent's Enemy Layers (Character Layer Manager component) is set to include "Enemy" and "Character"
  • The player's root object is on the "Character" layer
  • m_DeathmatchAgent.TargetInSight(m_FieldOfView.Value, m_MaxTargetDistance.Value, m_IgnoreTargets.Value) always returns false, even if I pass in 360 degrees for field of view, 200 for distance, and null for ignore targets, and then stand directly in front of the agent. The agent just walks into the player and tries to keep walking.
Any ideas what I might be missing?
 
I should also note:
  • The player's character is using the 3rd person adventure controller
  • The player's collider is on the "Character" layer
 
Last edited:
If you set a breakpoint within TargetInSight what line returns false when you'd expect it to return true?
 
Physics.OverlapSphereNonAlloc(LookPosition, maxDistance, m_HitColliders, m_CharacterLayerManager.EnemyLayers, QueryTriggerInteraction.Ignore) is always zero

Below you can see the capsule collider on the player and the agent is right up against the player, but still can't see him

capsule.png
 
If that is always 0 and the distance is large then double check your enemy layer on the layer manager.
 
I ended up creating a new project and more or creating the player and agent again. The problem did not occur this time. I suspect it may have had to do with another asset that was imported into the project, but still not sure what specifically caused this behavior.
 
Top