Forum rules - please read before posting.

Custom Footsteps for individual Players

Hi,
I’ve been trying to figure out how to set up custom footstep sounds for each individual player character. In my game, I use Players as NPCs, and each one is supposed to have their own unique footstep sounds. However, I can’t seem to get them to play correctly when they’re in the scene with me.

I’ve followed the tutorial, added the Footstep Sounds script, added the correct surface for each character, and even tried changing the footstep sounds in the OnStart method — but nothing seems to work.

I’m not sure how to assign different footstep sounds to specific players and have them play correctly when multiple characters are present in the same scene.

I'm using version 1.82.6.
Thank you for your help!

Comments

  • You can do this by storing the sounds in a new Surface type that is assigned to the character via custom script, rather than mapped to a floor in the actual scene.

    In the Footstep Sounds component Inspector, uncheck Auto-detect Surface?, and then rely on a custom script that hooks into the OnRequestFootstepSounds custom event, which triggers whenever it wants to know what Surface it's over, and then assign it manually.

    Sample script, attached to the same object:

    using UnityEngine;
    using AC;
    
    public class CustomSurfaceSetter : MonoBehaviour
    {
    
        public int surfaceID;
    
        void OnEnable () => EventManager.OnRequestFootstepSounds += OnRequestFootstepSounds;
        void OnDisable () => EventManager.OnRequestFootstepSounds -= OnRequestFootstepSounds;
    
        void OnRequestFootstepSounds (FootstepSounds footstepSounds)
        {
            GetComponent<FootstepSounds> ().CurrentSurface = KickStarter.settingsManager.GetSurface (surfaceID);
        }
    
    }
    
  • thank you, thank you! that did the trick.

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.