- Home /
Change the running AnimationState of an Animation
Hello everyone !
I'm new using animations in unity. I created in blender 3 animations for a fish mesh and I now have 3 animations clips. For now, I have attached to my mesh's animation; one main clip as "animation" and in my "animations" list my 3 clips like this:
My main animation "mouvement" is running, but i would like to be able to change to another one.
I tried this in code:
Animation anim = fish.GetComponent<Animation>();
anim["mouvement"].enabled = false;
anim["left"].enabled = true;
It stops the "mouvement" animation but doesn't run the "left" animation. Is there a way to do it ?
PS: I also thried with the an Animator, but when I drag a clip into the animator windows, it creates a state, but the clip inside it is set to None I can't put one of my clip (even if I can change it to other clips already present in Unity).
PS2: all my clips are working, I tested it bu changing the main clip in the mesh animation
Your answer
![](https://koobas.hobune.stream/wayback/20220612221321im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
2D Animation does not start 1 Answer
Animation (Legacy) vs Animator (New). 5 Answers
Playables API - Can I set a speed of the clip ? 0 Answers
Set animation's CLIP parameters? 0 Answers