Forum rules - please read before posting.

Different Footsteps on certain areas of the terrain

Hi all,

I have been struggling with this and maybe you guys can help me.
I followed these instructions https://adventure-creator.fandom.com/wiki/Sync_footstep_sounds_with_collider_materials
My player is walking several different surfaces. But the error I am getting is object reference set to null, although I have added all required fields. Is there any other way so that the player footstep sounds can play on different areas of the map, for example grass, tiles, etc.

Comments

  • edited December 2023

    Can you share the exact message you're getting, stacktrace included, as well as your AC/Unity versions and a shot of the component's Inspector?

  • Hi Chris, thank you for your reply.
    Here is the full error message:

    NullReferenceException: Object reference not set to an instance of an object
    AutoSetFootstepSounds+FootstepMaterial.Apply (AC.FootstepSounds footstepSounds) (at Assets/Scripts/Player/AutoSetFootstepSounds.cs:70)
    AutoSetFootstepSounds.OnStandMaterial (UnityEngine.PhysicMaterial material) (at Assets/Scripts/Player/AutoSetFootstepSounds.cs:52)
    AutoSetFootstepSounds.LateUpdate () (at Assets/Scripts/Player/AutoSetFootstepSounds.cs:33)

    I am currently running Unity 2022.2.10 and AC v1.79.1
    Here is a screenshot of the component assigned to the player.

    I have added all the required Physic Materials to the required floors. All of the floors are on the default layer.

  • Thanks @snan I managed to get the player to detect the different terrains, but now for some odd reason the footstep sound does not stop playing and it is looping over each other and** Only play grounded is** checked.

  • @snan the sounds are playing automatically from the sound source. What else do you require because I gave everything that is needed for this to work.

  • The Auto Set Footstep Sounds component merely affects which sounds are played. Playback is still down to your Footstep Sounds component.

    Can you share the Footstep Sounds component Inspector, as well as the expanded Audio Source it's set to affect?

    To pre-empt: if you've got Play sounds set to Via Animation Events, can you also share your character's Animator?

  • Hi @ChrisIceBox thanks for your reply. I will share a couple of images with you.

    Player prefab - SND EFX is where the Audio source, Sound, Footstep sound, and Auto set footsteps sounds components are stored.

    The actual SND EFX component

  • They are set to play automatically, based on the character's movement. Are the AudioClips themselves one step each (i.e. not a long series of step sounds)?

  • The footsteps sound are a basic loop of 4 steps per loop. But I thought that the sound would stop as soon as the player stop moving.

  • It won't, that could cause it to cutoff mid-step.

    Separate them into 4 and assign each separately.

  • Will so thanks Chris.
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.