Hello,
I’m fairly new to Unity so i’m watching lots of tutorials at the moment and then trying to adapt them to some ideas I have.
One of my ideas is to have a different footstep sound played depending on the type of object being walked on. So for example grass would sound different to gravel.
So I have 2 methods set up as seen below:
//Called by the animator
void PlayLeftFootSound()
{
if (leftFootSound)
{
AudioSource.PlayClipAtPoint(leftFootSound, transform.position);
}
}
//Called by the animator
void PlayRightFootSound()
{
if (rightFootSound)
{
AudioSource.PlayClipAtPoint(rightFootSound, transform.position);
}
}
These are called by the animator when the foot of the player is put forward.
What i’d like to do is a check within these methods to find out what block type the player is colliding with so that based on that type I can play a different sound.
Please feel free to shunt me in a different direction if you feel im going about this the wrong way.