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

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » General Dicussions » Answering some FAQ from the "Help (General)" section

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

View previous topic View next topic Go down  Message [Page 1 of 1]

BryceCain25


SUPER MODERATOR
SUPER MODERATOR
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

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum