0
\$\begingroup\$

I've applied a scale animation on Play button of my game. I want to stop animation when play button is not interactable. It stops playing animation, but animation is not playing again, even when play button gets interactable. Here is my snippet to Play and Stop Animation.

if (!PlayButton.GetComponent<Button> ().IsInteractable()) {
    PlayButtonAnimator.Stop ();
} else if (PlayButton.GetComponent<Button> ().IsInteractable()) {
    PlayButtonAnimator.Play ("Play_Button_Animation");
}

What should i do to play animation again. Thanks in advance :)

\$\endgroup\$
1
\$\begingroup\$

Not sure if this is the exact answer but instead of doing a PlayButtonAnimator.Stop()you could add a New State into the animator and call PlayButtonAnimator.Play ("New State") when the button is not insteractable.

if (!PlayButton.GetComponent<Button>().IsInteractable())
{
    animator.Play("New State");
}
else if (PlayButton.GetComponent<Button>().IsInteractable())
{
    animator.Play("Play_Button_Animation");
}
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.