Question by
costin88boss · May 22, 2020 at 04:01 PM ·
animationanimatoranimator controllerstop animationsstopping-animation
Stop Animation when bool is false?
so i have a simple animation called "Walk", where it should stop animation when user does no longer presses a or d. here is the script: void Update() {
if (Input.GetKey(KeyCode.D) && !Input.GetKey(KeyCode.A))
{
Idle = false;
Ani.SetBool("WalkAnim", true);
}
else if (Input.GetKey(KeyCode.A) && !Input.GetKey(KeyCode.D))
{
Idle = false;
Ani.SetBool("WalkAnim", true);
Ani.
}
else
{
Idle = true;
}
if (IsRunning)
{
}
else if (IsCrouching)
{
}
else if (IsCrouchMoving)
{
}
if (Idle)
{
IsRunning = false;
IsCrouching = false;
IsCrouchMoving = false;
Ani.SetBool("IsIdle", true);
Ani.SetBool("WalkAnim", false);
}
else
{
Ani.SetBool("IsIdle", false);
}
}Also, Ani is Animator. the rest are bools that will be used (i did not made run, jump, crouch, etc now).
aaaaaaaaaaaaaaaaa.png
(7.2 kB)
Comment
Your answer
Follow this Question
Related Questions
Animation Running Game 0 Answers
How do I puse an animation? 1 Answer
How to set the blend tree threshold value during run time? 0 Answers
Continuous keydown in Animator 0 Answers
Syncing Animations both playing from Seperate Animators 0 Answers