- Home /
Animation Crossfade won't play but Animation Play does
Hi,
I have an animation that I need to play with animation.Crossfade for transitional sake but it doesn't work, only playing two or three frames before stopping. When set up as animation.Play it works fine but the animation transition is unacceptable.
Does anyone know the reason for this and a solution?
How long is the animation? crossFade, if you don't say, takes 3/10ths sec in and 3/10ths out, so can appear to do nothing on short ones.
The animation probably takes roughly two seconds at longest and is about 10 frames?
10 frames "wants" to be about 1/3 of a second (somewhere in there.) So, to clarify, you have animation["shrug"].speed=0.16f;
to force it to play slower/longer?
Do you have it set as, for example: if(Input.Get$$anonymous$$eyDown(x))?
If so try getting rid of the down, as well, try putting it into its own layer: .layer = 1;
Answer by PrimeDerektive · Sep 09, 2011 at 07:42 PM
I've encountered this problem too. As Owen said, CrossFade takes at least 0.3 seconds, so if the animation is shorter than that, it won't work. Manually slowing down the animation in script (changing the .speed) will not work either. If it's a one shot animation, you can sometimes getting away with adding a keyframe through the Unity animation editor that is further down the line to artificially lengthen it... otherwise, you're pretty much relegated to slowing down the animation in a 3d modeling package.
Well, if too short is the problem, CrossFade has an optional 2nd parm for the "fade in/out time": animation.CrossFade("shrug", 0.1f);
I've had good results with that.
Yep... I've gotten models before though where the actual animation is like 5 frames and 0.02 seconds long or something retarded. Setting the crossfade fade in time that low barely results in any visible difference than .Play().
Your answer
Follow this Question
Related Questions
Play Animation on trigger enter 1 Answer
I can't script enemy animation 0 Answers
Animation Script Error 1 Answer
How to play an animation at least once before changing 2 Answers
problem not playing animation on keyDown 2 Answers