- Home /
Question by
Metoyoubear · Mar 29, 2014 at 03:49 PM ·
animationaudioplay
Playing audio immediately
Hi! I need to know how to play an audio immediately when an animation is rendered. So, there will be no delay or incompatibility between the audio and animation. My currently script is:
Renderer[] AllMesh5 = dog_jumping.GetComponentsInChildren(); GameObject cube = GameObject.Find("Cube"); if (cube) { cube.audio.Play(); cube.audio.loop = true; }
foreach(Renderer EachMesh in AllMesh5){
EachMesh.enabled = true;
}
Your help is really appreciated :)
Comment
There ARE PLENTY of such answered question on Unity Answers all you got to do is search
Sorry didnt mean to be rude
Answer by deltamish · Mar 29, 2014 at 03:50 PM
Hi you could do it easily by using
public AudioClip = clip;
void Start()
{
audio.PlayOneShot(clip);
}