Single looping Animation clip without Animator Controller

I have an object that should animate with a single Animation clip. I would rather not create a controller for this simple animation, so I’ve added an Animation component to the object and assigned a Clip to it. Play Automatically is checked, but it will not play the animation. Am I missing something?

37368-unity-animation-component.png

For everyone who is still interested in this question:
This is the Legacy Animation component. This component is only in Unity for backwardscompatiblity.
I dont know a way of just adding an animation to an object without controller, but you can Drag and Drop your animationclip on the Gameobject, which generates the controller automaticly for you.

For everyone still looking for this solution. Simply select your animation clip and check “loop” as wrapping mode in the inspector! No need for a controller :slight_smile:

@theLucre

Also If your animation is part of fbx model. You can set wrap mode from code. Like this:

 Animator animator = GetComponent<Animator>();
 Animation animation = GetComponent<Animation>();
 
 var clips = animator.runtimeAnimatorController.animationClips;
 foreach (AnimationClip clip in clips)
 {
     clip.wrapMode = WrapMode.Loop;              
     clip.legacy = true;
     animation.AddClip(clip, clip.name);
 }
 
 animator.enabled = false;
 animation.enabled = true;
 
 animation.CrossFade("Idle", .25f);