I want the game to play a different sound when the character walks on water or grass
this is my script
using UnityEngine;
using System.Collections;
public class SuonoAcqua : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public AudioClip WaterSplash_Long;
private AudioSource WaterSplash_LongAudioSource;
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == “Water”)
{
//AudioSource audio =GetComponent (WaterSplash_Long);
WaterSplash_LongAudioSource.clip=WaterSplash_Long;
WaterSplash_LongAudioSource.Play ();
}
}
}
but it doesn’t work at all.
How can i play a sound when the character collides with the water? (i added a mesh collider to the water but still doesn’ work)
pls help