I am creating a 3d endless runner game. Currently my game object contains two further child (Rider and the horse). The component (Animation)is attached to rider only and in the animator component play automatic is enabled. Now the problem is that its default animation is “horse_galloping” which is working fine. whenever i press “space” key jump animation plays once but the previous animation “horse_galloping” stops working, although the loop is enabled but still its not working after hitting space key. What i want is to keep playing animation “horse_galloping” after the “horse_jump” animation is played.
Following is my code::
private Animation anim;
void start()
{
anim = mygamebobject.GetComponent ();
}
update ()
{
if (Input.GetKeyDown (“space”))
{
anim.CrossFade(“horse_jump”);
}
}