- Home /
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?
An old thread, but be sure that in the Import Settings -> Rig of your object, Animation Type is set to "Legacy".
Answer by DimensionDragon · Sep 14, 2017 at 08:21 AM
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.
Answer by decastronathan · Jun 22, 2019 at 12:17 AM
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 :)
Answer by zulusred · Jul 12, 2019 at 11:49 AM
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);