Crossfade only works the first time

Is there any reason why crossfade would only work the first time it’s called? The jump animation (2 - same frames) that’s being crossfaded to is using clamp forever with a stop at the end. It crossfades the first time, but every time after that the transition is instantaneous. Perhaps it’s not rewinding? (Seems like I’ve had problems with clamp forever before).

Hey man, I’ve just fixed this ‘bug’ myself involving ClampForever. I’ve been trying to solve what I had done for 3 days and it turned out to be an idiot error.

ClampForever STAYS on the LAST frame of an animation FOREVER until a new animation is called. The CrossFade function will fade one animation to another, within a time period. Since one animation (your jump animation) sticks at the last frame, there isn’t really a time for CrossFade to fade the new animation in, which will result in either the ClampForever animation or a new animation instantly. I don’t know really how to explain this in a good way, but I hope you get the point.

But just to help you out here, I’ve seen that you want to create a Jump / Land animation, try this one:

using UnityEngine;
using System.Collections;

public CharacterController CharCont;
public CharacterMotor CharMotor;

public bool WasStanding;


if(WasStanding && !CharCont.isGrounded)
{
	WasStanding = false;
	JumpAnimationHolder.animation.Play("Jump");
}
else if(!WasStanding && CharCont.isGrounded)
{
	WasStanding = true;
	JumpAnimationHolder.animation.Play("Land");
}

Try using that with the CrossFade function, and it might help you out, I haven’t tried the CrossFade myself, because I don’t really need it, good luck and I hope I was of use! :slight_smile: