Can hear object not working with footsteps. Is there a better solution than searching for child-audio-sources?

Kutlu

New member
Hi Opsive!

I am trying to make Behaviour Designer 'Can Hear Object' work with the generated footstep sounds in UCC. I found this thread from a few years ago and implemented the solution there, which was to use targetObject.GetComponentsInChildren<AudioSource>(targetObject).

I'm not too satisfied with this, as there are a lot of wasted operations in order to retrieve the audio sources. In the thread I linked (which is from 2018), you mentioned that you wanted to come up with a better solution. Have you done so? Could you point me in the right direction? I would really appreciate it.

Thank you
 
Right now the GetComponentsInChildren option is still the best route. I agree that it isn't seller for performance but I haven't been able to implement anything better yet.
 
Hi Justin! Thanks for the response.

I was wondering: what is the script/GameObject that spawns the audio sources at the player character's feet? I couldn't find it after searching through the codebase.

I looked at the documentation on the topic of the Audio Manager as well, but unfortunately it didn't have the answers I needed.

I am just itching to interact with and expand your excellent code.
 
It's the CharacterFootEffects script. This script uses the Surface System to spawn the effect.
 
Top