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
You're better off writing this as C# code
What you have now functionally looks like this:
Where this script is attached to your button and the Ellen gameobject's
Animator
component is assigned to theellen
field.If you change it like so:
Now you just need to supply a duration for the audio clip. There may also be a way to query the audio source's current play status, but I don't have enough information about your project to be able to hash that code out in a functional way.