Hey a supernoob question! Am an animator just getting going with scripting. I’ve searched the forums for ages trying to find an explaination that i could understand but no luck so far.
My problem is that while I’m able to assign keys to trigger character animations I haven’t been able to figure out how to assign different audioclips to the animations. so that when a player presses “2” for instance it plays an animation and an audioclip at the same time. and then if i press “3” it will play another anim and audio clip. It seems like it should be easy so i hope that someone can help. It’d be great if you can–Thanks!!!
heres cut down version of the character anim that works so far. I just have no idea how to add audioclips into this equation.
var idle : UnityEngine.Animation;
var anim : UnityEngine.Animation;
animation.wrapMode = WrapMode.Loop;
animation["idle"].wrapMode = WrapMode.Loop;
animation["Anim01"].wrapMode = WrapMode.Once;
function Update () {
if (Input.GetKey ("2"))
{
animation.CrossFade("idle");
}
if (Input.GetKey ("3"))
{
animation.CrossFade("anim");
}
}
![]()