Animation Event Loop

In the animation tab i set an event that fires off “RepaetAnimations()” in the “testCube” animationon at the very last frame.

I am not sure why this script does not loop? It will print to console 1 time only, and 2 time if I add “anim.Stop(“testCube”);” above “Crossfade”.

    private Animation anim;

    void Start()
    {
        anim = gameObject.GetComponent<Animation>();

        anim.Play("testCube");
    }

	public void RepaetAnimations()
    {
        print("repeat anim");
        anim.CrossFade("testCube");
    }

But this method will loop the animation.

public void RepaetAnimations()
    {
        print("repeat anim");
        anim.Stop("testCube");
        anim.Play("testCube");
    }

I am using the Animation Component and not the Animator.

Thanks: James

From Unity’s documintation about crossfade:

If the animation is not set to be
looping it will be stopped and rewound
after playing.

Make sure to set the animation to be looping.