- Home /
Play simple animations on demand
Currently my player object has an Animator
with an AnimatorController
that manages things like walking, jumping and running. The thing is that I want to play certain simple animations on demand, like opening a door or pressing a button. I don't think creating a state for each of those is the best solution because they happen in very specific moments and don't need to have a complex system with a state, transitions and parameters in the controller.
Basically those animations could be triggered by some InstantAnimator
component with a method as simple as a PlayAnimationClip(AnimationClip clip)
that overlap the current animator state and simply play the given animation clip.
I tried to implement something like this using the AnimatorOverrideController
but it only replaces animations that already exist in the controller, there is no way to play new ones. I also read a few things about the Animation
component, but i'ts legacy so I think that there might be some other solution that isn't legacy.
The question then is: Is there a way to do this? Or I should actually create a state in the animator controller for each of those small animation clips?
Answer by cdr9042 · Aug 28, 2019 at 05:20 AM
SimpleAnimation can do it, but I haven't tested how it'll work together with an Animator Controller
https://blogs.unity3d.com/2017/11/28/introducing-the-simple-animation-component/
Your answer
Follow this Question
Related Questions
Back to "default transform" after animation interrupts 1 Answer
Play either the first or second animation on an object without specifying its name 1 Answer
Animation layer naming convention between enemies and player 0 Answers
How do i orginize 8+ movement animations? 1 Answer
Not all animations are replaced when using an Animator Override Controller 0 Answers