- Home /
Can animation clips be swapped out of the animator override controller in runtime?
I understand that animations can be swapped out of the animator controller by using the animator override controller. What I want to do is swap out the animation clips of the override controller in runtime. The reason I want to do this is because the player will have to choose 3 animations out of a list of 'moves', these moves can be in any order and as the game will be updated, more and more animations will be added to the list. The animations will be played in sequence and then the player can choose another 3 to play after the previous 3 are done.
.
So this isn't swapping out animations per character but one character that can do any animation at any time. Yes I know about the "any state" box in the animator controller and I can use that and I know that will work but at some point there will be 20+ animations and more will be added every update of the game so it will start to look messy.
Answer by Shadex · May 21, 2019 at 09:05 AM
Thats going to get really messy. An alternative approach is to make an int parameter in the animator and use it as a condition. For instance put skillID equals 1 on the transition to skill 1's animation state, and do that for each skill. Now just change the animator paramter like animator.SetInteger("SkillID", 1); when the player chooses skill 1 and your good. Better yet, when you decide you want 16 skills, it's easy to add them in.
Your answer
Follow this Question
Related Questions
How to disable/override a part of an animation created in Unity 2017.4 0 Answers
Why do my animations only play once? 1 Answer
Cannot cast RuntimeAnimatorController to AnimatorOverrideController 0 Answers
Preview overridden and ovverriding animation at once 0 Answers
How to change animation clips of an animator state at runtime? Is there a way? 5 Answers