- Home /
How to emulate/trigger the Pressed parameter of an animation
Hello,
I don't mean emulate, I want to trigger the Pressed animation with the escape key, but I want it to act as though I am pressing the button.
I've tried so many different things, even using bools and and tracking the time pressed etc but it only worked on pc and not on Android lol.
This is what I have so far;
anim.SetBool("Pressed", Input.GetKeyDown(KeyCode.Escape));
which sets it off, but when I let go of escape it just resets the animation.
Then I tried this
if (Input.GetKey(KeyCode.Escape)) // also tried GetKeyDown
{
anim.SetBool("Pressed", true);
}
else if (Input.GetKeyUp(KeyCode.Escape))
{
anim.SetBool("Pressed", false);
}
Is there an easier way to do it? I tried setbool for my own parameter and made it a condition, I just can't figure out how to get the animation to stop when I let go...hmmmi suppose I can try anim.stop or something? lol
Thanks
Your answer
Follow this Question
Related Questions
Character legs/knees twisting inside in animation 1 Answer
Scale animation with model 1 Answer
Can you change AnimationClip in controller via scripting? 0 Answers
Gettings Animations in LocalSpace (Parenting Not Working) 0 Answers
How to use the imported animations from Maya in the animator controller? 0 Answers