- Home /
How to change animation controller for differnet weapons?
Hi,
I'm building a 2D pixel-art RPG, with sprite sheet animations. I want to include different weapons that alle have different move sets, so that the character also has to move diferent for every weapon. For example the sword performce 3 different slashes but the daggers just has 2 stabs and so on. I am struggeling to find a solution how I can change my AnimationController. First I thought I use a RuntimeAnimationController and an OverrideAnimationController but the problem is, that not only one Animation changes but a different number of them. Also creating one OverrideAnimationController for each Weapon on top of the basic character controller would'n work because the character can equip 2 Weapons so I would have to have one Controller for every combination.
I thought maybe I could store the different attacks in a Weapon prefab and then do some kind of animator.PlayOneShot(animtation) but there is no such function for Animators. The only way I see right now is to have one Attack state in my AnimationController and for every Attack befor triggering it to change the animation to the right one. Is there a better way to approach this?,
I also could put all the animations in one big Animator and play them with Animator.Play(). Then the Weapons would know wich state to play and I could set the animator to return to some default state after an Attack.
Is there a problem with creating large animaotrs? otherwise this would be a simple solution for the problem.
Your answer
Follow this Question
Related Questions
2D Animation does not start 1 Answer
How to manage 2D animation states (of same behaviour) for multiple type of characters/enemies? 1 Answer
How to reset an animation from Animation to beginning before turning the gameobejct off? 0 Answers
Can the Animation Controller be used to create a sequence from multiple objects & animations 0 Answers
Sprite animations won't export/run in a published build unless you play in editor first 1 Answer