This is similar to the topic https://www.pixelcrushers.com/phpbb/vie ... nse#p15392
Hello Tony,
I wish to play a sound when the response button is clicked. I followed along the previous post and the sounds works, but the response button is no longer catching the onclick event and the response is not caught. I added an OnClick event to play the audioSource on the Button Component.
My Response panel uses the option to automatically create buttons and the Response template button has the component StandardUI Response Button. It seems one
Am I missing a step?
Response buttons and AudioClip
Re: Response buttons and AudioClip
StandardUIResposnseButton has this at the start
if (button != null && button.onClick.GetPersistentEventCount() == 0)
{
button.onClick.AddListener(OnClick);
}
Is there anything to watch out for if I remove the check?
if (button != null && button.onClick.GetPersistentEventCount() == 0)
{
button.onClick.AddListener(OnClick);
}
Is there anything to watch out for if I remove the check?
Re: Response buttons and AudioClip
Hi,
No need to remove the check. Just configure your Button's OnClick() UnityEvent to also call its StandardUIResponseButton.OnClick method.
No need to remove the check. Just configure your Button's OnClick() UnityEvent to also call its StandardUIResponseButton.OnClick method.
Re: Response buttons and AudioClip
Thank you for the guidance Tony!
Re: Response buttons and AudioClip
Glad to help!