Adding sound effect to response menu

Announcements, support questions, and discussion for the Dialogue System.
Mournsey
Posts: 2
Joined: Tue Sep 27, 2022 3:43 am

Re: Adding sound effect to response menu

Post by Mournsey »

Hi there, I'm trying to get some audio to play upon button click.

I'm able to get the sound effect to trigger by adding an audio file to the button's 'on click' event but this then disables the buttons function in game.

The sound of the button will trigger but prevents the dialogue from continuing. When I remove the 'On Click' event with audio it works again.

I'm a bit confused why the audio would be stopping the button from continuing the dialogue.

Thanks in advance.
User avatar
Tony Li
Posts: 20755
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adding sound effect to response menu

Post by Tony Li »

Hi,

Assign the StandardUIResponseButton component's OnClick to the UI Button's OnClick() event in addition to the sound effect. The StandardUIResponseButton will only automatically add its OnClick at runtime if nothing is assigned to the UI Button's OnClick() event. If anything is assigned to OnClick(), it will not auto-assign itself. (This gives designers the option to assign different functionality that doesn't immediately select the response.)
Mournsey
Posts: 2
Joined: Tue Sep 27, 2022 3:43 am

Re: Adding sound effect to response menu

Post by Mournsey »

Hi there, thank you so much for the reply!

This worked, thank you kindly! I really appreciate the help!
User avatar
Tony Li
Posts: 20755
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adding sound effect to response menu

Post by Tony Li »

Happy to help!
duolazhang
Posts: 10
Joined: Fri Oct 06, 2023 10:54 am

Re: Adding sound effect to response menu

Post by duolazhang »

Encountered the same problem, but your solution resolved it. Thank you!
Tony Li wrote: Tue Sep 27, 2022 9:44 am Hi,

Assign the StandardUIResponseButton component's OnClick to the UI Button's OnClick() event in addition to the sound effect. The StandardUIResponseButton will only automatically add its OnClick at runtime if nothing is assigned to the UI Button's OnClick() event. If anything is assigned to OnClick(), it will not auto-assign itself. (This gives designers the option to assign different functionality that doesn't immediately select the response.)
Post Reply