- Home /
audioclip is not working
I'm developing game and I have problem I add AudioClip but It not working when I'm run my project It doesn't have sound
the first condition is when collider at down flex I want "down" sound the second condition is when collider at top I want "top" sound
the code can run well (without error)
wheat should I do Thank you
public AudioClip top; public AudioClip down;
void OnTriggerEnter( Collider collider ){
if (collider.name == down_flex) {
step1 = 1;
step2 = 0;
Debug.Log("step1="+step1);
audio.PlayOneShot(down);
}
if (collider.name == top_flex) {
step2++;
Debug.Log("step2="+step2);
if(step2==1){
audio.PlayOneShot(top);
}
}
if (step1 == step2) {
score ++;
Debug.Log (string.Format (scoreSyntax, score));
;
}
if (score == 5) {
//change scene
StartCoroutine(WaitingFunction());
}
}
Verify that you have an audioListener in the scene, and that it is not muted and that the volume on the audioListener is high. Check that the audioSource is within the "$$anonymous$$in Distance" to the audioListener, or that the audioClip has "3d sound" unchecked. Verify that the clip file is valid. Try playing the clip in the unity editor directly. Check that the audioSource has high volume, is not muted, and has a reference to the clip in the "Audio Clip" field. Try changing the audioListener "Volume Rolloff" to "linear".
Your answer