Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink
Share
Go down
avatar
SUPER MODERATOR
SUPER MODERATOR
Posts : 279
Points : 2168
Rep : 58
Join date : 2013-12-16
Age : 17
Location : Boise Idaho United States
View user profile

Answering some FAQ from the "Help (General)" section

on Thu Aug 14, 2014 5:17 am
Frequently asked question:
"Animation not playing??"
Answer:
you will need to add code and a animation component to make this all together work Smile
here is some sample code:
Code:
#pragma strict
var punchanim : AnimationClip;
var sitanim : AnimationClip;
var idle : AnimationClip
function Start () {
animation.CrossFade(idle.name,0.2) 
}
function Update () {
if(Input.GetMouseButtonDown(0)) {
animation.CrossFade(punchanim.name,0.2);
}
if(Input.GetMouseButtonUp(0)) {
animation.CrossFade(idle.name,0.2);
}
if(Input.GetMouseButtonDown(1)) {
animation.CrossFade(sitanim.name,0.2);

}
if(Input.GetMouseButtonUp(1)) {
animation.CrossFade(idle.name,0.2);
}


}



this should be really dynamic, make sure you add your sitanim (example) and punchanim (example) to the animation component and attach this script and add into variables your animations.

This is all the time I have to look right now, I will edit this thread as soon as someone poses a new FAQ
Thank you!
-BryceCain25
Back to top
Permissions in this forum:
You cannot reply to topics in this forum