- Home /
Character Animation Gets Rid of Idle Animation
Hi. I am using the character controller and I added another VERY short script so my character could attack. Whenever I play the game, the character does the attack animation but DOESN'T do the idle animation. It is as if the attack animation got rid of every animation except its own. Is that attack script simply overriding the character controller?
Here is my script:
#pragma strict
function Start () {
}
function Update () {
(Input.GetButton("Scratch");
animation.CrossFade("Slash");
}
If you have an answer please tell me, I need this answered to proceed.
Thanks!
Answer by Seth-Bergman · Mar 15, 2013 at 01:01 AM
you need code for that too, something like:
function Update () {
if(Input.GetButtonDown("Scratch")) //fixed syntax error here
animation.CrossFade("Slash");
else if(!animation["Scratch"].normalizedTime > 0) // or something
animation.CrossFade("Idle");
}
unless you mean you want them both to blend together, in which case you need to play with blending:
http://docs.unity3d.com/Documentation/Manual/AnimationScripting40.html
looks like this may be deprecated though.. I don't know if there is a newer way now..
Thanks! This was really helpful! I decided to re-do my code though, since it was kinda messed up.
Your answer
Follow this Question
Related Questions
Animation problem with rotation and position. 0 Answers
Animation problem 0 Answers
How to export MMD model to Unity? 0 Answers
Reload FPS Animation Not Playing (Javascript) 1 Answer
Can the animation editor create local rotational data? 3 Answers