- Home /
Changing sound when walking in different areas.
I want my character to sound like he is walking on leaves and twigs when he is in the woods and then switch to a different sound when he is walking on the sand or road. Is it possible to do this with the terrain or will I need to set up triggers? (And how would I go about doing that)
Answer by iamvishnusankar · Feb 12, 2014 at 09:54 PM
The best method is to set up triggers on the places you want change the sound. Just create basic cubes and Turn Off Mesh Renderer to make it invisible. Make sure you've checked "IsTrigger". And attach the following script to each trigger.
You can set the desired audio clip from the scripts inspector
public AudioClip myClip;
void OnTriggerEnter(Collider other)
{
audio.clip = myClip;
}
Your answer
Follow this Question
Related Questions
how to swap a mesh using an array 1 Answer
Switch Camera on Input in C# 3 Answers
on touch swap texture, wait until sound played then swap texture back 1 Answer
How can I combine GUI button with script that is put on different gam objects? 1 Answer
How to change 'vertical' and 'horizontal' axis when rotating the object 0 Answers