Forum rules - please read before posting.

Menu hover and click sounds sometimes not played

edited October 2019 in Technical Q&A

Menu click and hover sounds isn't played when game is paused?

I have wired up a title screen according to wired up according to these posts:
https://adventurecreator.org/tutorials/creating-title-screen-menu
https://adventurecreator.org/tutorials/creating-title-screen-menu-2

I have a back button on Options:
https://1drv.ms/u/s!Amz_vh8OYDX3u-JPAEV8dH36LXgcUA?e=DdSxRa

When the options is showed over the title screen scene, the hover sounds are played but not the click sounds.
When the options is showed over a game scene, the hover sounds are not played but not the click sounds are.
The pause menu (shown only in game) ignores both the hover and the click sounds.

There is a default sound specified on each scene.

Comments

  • I noticed that enabling "Play while game is paused" on the sound solves some of the issues.

    Byt the click sound on the back buttons on the Options and Load menus still won't sound when shown on the title screen.

  • I noticed that enabling "Play while game is paused" on the sound solves some of the issues.

    This should be enabled by default for the Sound prefab, and is indeed necessary for sounds played from paused menus. I shall add a warning to the Console, however, if this is not the case.

    Byt the click sound on the back buttons on the Options and Load menus still won't sound when shown on the title screen.

    If it's scene-dependent, anything special about the title screen? I'm assuming this is still an AC scene. What if you temporarily switch the menu's Source back to Adventure Creator?

    The click sound should play via the MenuElement script's ProcessClick function. Insert the following into it to show debug logs in the Console - what do they show?

    Debug.Log ("Clicked element " + title + " in menu " + _menu.title + ", Click Sound: " + clickSound + ", SceneSettings: " + KickStarter.sceneSettings);
    
  • That method is executed, and outputs:
    Clicked element BackButton in menu Options, Click Sound: sfx_menu_click (UnityEngine.AudioClip), SceneSettings: GameEngine (AC.SceneSettings)

    And I saw in the debugger that the sound is actually played but then immediatly interrupted by the hover sound from the next menu.

    Perhaps it would be better to replace (in PlayDefaultSound):

    defaultAudioSource.clip = audioClip;
    defaultSound.Play (doLoop);
    

    with
    defaultAudioSource.PlayOneShot(audioClip);

    Thanks

  • Does such a replacement resolve the issue?

  • Yes, since the click sound ins't interrupted by the hover sound. In general I think one shot makes perfect sense for hover sounds, otherwise clips with long tails will be cut off for sure.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.