Play step sounds depending on material

Hi

I want to be able to play different step sounds depending on what material my player currently is on. Everyone would say like “use tags and stuff” but I can’t. My map is built with big chunks with multiple materials so it wouldn’t be very easy. So is there a way so I can detect a material and play a specific sound when they are stepped on?

Thanks in advance

I don’t know about materials working in that sense(though I think it can be done), but I recommend you make a quick script. It would have the public variable of a sound clip. Then either you can call the script itself to play the sound upon collision, or you can simply access the correct sound clip from your other object. Either way, you have a quick and easy way to place certain sounds on certain objects, and easy access to them, without having to mess with tags, etc…

It looks from your post like you have a single object that has lots of colliders(or maybe a single mesh collider). So your situation may not be exactly as nice as I’m making it out to be. So, if you are just using a single collider, you may want to create a separate set of colliders just for the floor(stairs maybe too, and ramps) so that you can separately detect where you are stepping. If you are using multiple colliders instead of just a single mesh collider, then this step will not be necessary.

I know that there are ways to detect what materials are on objects via scripts. But, if it is a single object with multiple materials, I’m not sure how you would know for sure which one it is just because it is still all part of a single object and mesh.