0
\$\begingroup\$

enter image description here

I have a button and I have attached another script "PlaySound" for this button, which plays audio on button click. As soon as the audio gets completed, I want to stop the animation which I am triggering here in OnClick of Button. How do I access the Ellen gameObject and 0 parameter which I set in the Inspector window (check the picture) in the PlaySound script

\$\endgroup\$
0
\$\begingroup\$

Create a script with a public Ellen ellen; or whatever object you want to access. Then, in the script, check if the audio has finished playing and if it has, use Animator.SetTrigger(x), where x is the stop animation parameter.

To be honest, I would do this all in one script with a function to start the audio that waits till the audio finishes then starts a second function to stop the animation. Then use that instead of Ellen

\$\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.