Forum rules - please read before posting.

Calling the PlayFootstep() function called in animations other than walk & run

Hi. I implemented the footstep sound with the Footstep Sounds component, and the walk and run animations play that very well. But I also have other custom animations that need to play the footstep sound, however when I try to call PlayFootstep() in animations other than the walk and run animations, the footstep sound don't seem to play. Is it by design? Is there a way to work around it?

I am using Unity2019.4.6f1 with AC1.71.8.

Comments

  • Yes, by design the character needs to be considered moving by AC for it to work.

    I shall look into making this optional - or provide an alternative function that skips this check.

    However, if you move the component to a child object - i.e. not on the same object as the Player/NPC component - it will also bypass this check if you don't assign the Character field in its Inspector.

  • edited September 2020

    I see. As there are plenty of characters and animations I need to change, I would prefer to look forward to the next AC update. At the mean time, can I easily change 1 or 2 lines of code to bypass the check?

  • Open FootstepSounds.cs and replace:

    if (audioSource != null && footstepSounds.Length > 0 &&
    (character == null || character.charState == CharState.Move))
    

    with:

    if (audioSource != null && footstepSounds.Length > 0)
    
  • Got it! Thanks.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.