Third Person Controller Footstep system and Behavior Designer Can Hear Object Task


New member
1. Character Controller Type (Ultimate Character Controller, First Person Controller, etc).

Third Person Controller (though I suspect it applies to any of them.) and Behavior Designer

2. Unity Version (beta Unity versions aren't supported)

Unity 2018.2.16f1

3. Bug Description

Can Hear Object Task from Behavior Designer is not working well with the footstep system. I discovered this in my own scenes, but it can be reproduced in the Behavior Designer integration demo scenes .I've opened the thirdpersonmelee scene and it does not seem to work there either. I can walk behind agent nolan all night and they never hear me.

4. Steps to Reproduce

The layer mask doesn't seem right to me (as the characters are on the character and subcharacter layers not the enemy layer), but I've tried changing it to character and subcharacter to no avail. I tried changing the footstep type to set interval and it started getting heard by the task. Not sure why that would be different. However, the default bodystep type and other types don't every trigger the Can Hear Object task. The body step, doesn't seem to trigger it even though I can hear the steps in the audio.

Anyhow, the ThirdPersonMelee demo scene has the same behavior for me out of the box (other than building the nav mesh). Just bake the nav mesh and walk behind agent nolan and without being seen and have watch the behavior tree. Agent Nolan never reacts in game and Can Hear fails in the tree. Changing the player's footstep type to interval and fixing the layers on the Can Hear task to include the character and subcharacter layers can get it working but changing the layers only doesn't help with the body step footstep type.

5. The full error message (if any)

No error messages


Staff member
This is related to line 199 of MovementUtility. When Can Hear Object checks for AudioSources it does a GetComponentsForType which only checks the main object for AudioSources. If you change that line to:

if ((colliderAudioSource = targetObject.GetComponentsInChildren<AudioSource>(targetObject)) != null) {
Then it'll check for all of the children audio sources as well. This isn't as performance friendly though so I need to think of a better way to handle this case.


New member
Hi @Justin,

Just wondering if this has been fixed?

I'm having what seems like the same issue that others have had, in that the enemy agent can't hear any audio from the player. I've tried multiple settings for radius and threshold but nothing seems to work.

Last edited:


New member
Thanks @Justin,

I just gave it a try and assigned all our UFPS (The player) audio objects to a game object list and it still looks like nothing is happening. I have a radius of 50 which visually looks good, and a threshold of 10 . I've also tried assigning the player tag to the Target Tag field

Are there any recommended settings or another method I might try?
Last edited:


Staff member
The best way to debug this is to place a breakpoint within CanHearObject.OnUpdate and see where the task is failing when you think that it should be returning success. There are a lot of factors that go into determining if audio can be heard so placing a breakpoint is the best method to debug.


New member
Hi @AmazingPunk and @DragonFist.

I had this same issue when using the demo third person scene. It took a bit of testing and going through the code to figure out what the issue was and to fix it for me. You probably figured out the answer by now, but hopefully, this helps someone else out in the future.
  1. The first thing is to apply the work around @Justin mentioned above in the comments, so that audiosources in the children are checked as well.
  2. In the demo scene, the Third person controller when shooting the assault rifle does not have a sound clip assigned for shooting. There is only a sound when the bullet hits another object like the grass, AI character, etc. So add in an audio clip under Nolan>>Items>>AssaultRifle>>Use>>AnimatorAudio>>AudioClips.
  3. Open the behavior designer and select Agent Nolan. Then go to Can Hear Object and select the inspector.
  4. Use the target object or target objects options...not the object layer mask and max collision count. (Probably can make the object layer mask and max collison count options work as well, but it seemed harder to get it work.) Under target option drag in Nolan (Not the AI Agent Nolan).
  5. Adjust the hearing radius so it is large enough that the player is making noise inside the hearing radius for the AI to hear. Use the gizmos in the scene view to see the hearing radius.
  6. Finally, put Audibility Threshold to 0.
Now the AI player should hear the player and chase them anytime the player walks or fires their weapon inside the hearing radius.

The issue that I found that was happening is that there is a check in the MovementUtility script to see if audibility > audibilityThreshold. In the code just above that check the audibility is calculated. The audibility almost always comes out to be a number very close to zero, for example 0.0015. So Audibility Threshold needs to be basically 0 or a very low number like the example in order for the AI to hear the sound and chase the targetObject in the demo scene.