OK I followed a video tutorial for adding a sound clip to play on an animation event but the sound does NOT play when my animation reaches that point even though I have assigned the audio clip to the script in the inspector view and also to the Animation edit event window.
Here is my script it references:
var UFOexplosionSound : AudioClip;
function ExplodeUFOsound (clip : AudioClip)
{
audio.PlayOneShot(UFOexplosionSound);
}
This is not my final goal for this but I figured I would start with just seeing if I can get a sound to play and worry about trying to add an actual explosion to occure at that point later.
I'm not sure if these necessarily apply to you, but a couple reasons it would say that: if you set the event function, and then remove the component/move it to another object, or rename the function in code, without reassigning it in the animation editor.
I think like this code ,when read in animation even;
when you use this code ,you need don’t select “Play OnAwake”!My english is bad! Hope can help you!