- Home /
Question by
importguru88 · Aug 01, 2016 at 05:24 PM ·
animationanimator controllerdisableenable
How do I enable and disable animation in the animator controller by keys in unity3d
I want to enable and disable animation in the animator controller by pressing the key down . I know if statement input . I don't know where to start .
Comment
Answer by vintar · Aug 01, 2016 at 08:38 PM
You would need to add a bool parameter to your animator controller and use it to transition to and from a state. Then in script you would say :
if(Input.GetKey(KeyCode.AnyKeyYouLike)
{
Anim.SetBool("MyBoolName", true); //or false
}
controllerexample.png
(88.9 kB)
Your answer
Follow this Question
Related Questions
Possible to disable or hide an entire layer of animations? 1 Answer
Enable first person controller after a sequence 0 Answers
how to disable a button after pressing it and enable again after pressing another button 1 Answer
Animators Messing Up On Disable 0 Answers
Enable/disable animation 0 Answers