Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

Sound issues

edited January 29 in Technical Q&A

I am having various sound issues shown below and would be very grateful if anybody could assist me :smile:

Firstly, I have a sound clip that I want to play as ambience in the scene. However I can't get it to play on a loop. I have tried to play it with sound:play ambience , and also sound:play , both with "loop" checked but both times it plays once in the scene and then stops. I also tried dragging the output of the node back to the input to create a loop but to no avail. I also have three other wind sound clips playing at random which should also continue to play , but they only seem to play once and then stop, so after about a minute of game play , there is not a single sound playing in the scene. The idea is that the ambient sound will continually loop a fireplace crackling sound , whilst the other three wind sounds will randomly play with randomly timed pauses in between. The action list is shown below :

Secondly, with any sound, if I go to it's inspector and change the volume in the audio source component , it will always revert to a value of 0.9 when in game. How can I adjust the volume that a sound plays? I have also tried the relative volume in the audio script but any value under 1 just makes the sound inaudible.

Lastly , I added the above action list to the "play on start" action list for the scene , but whenever ANY action list is attached to the play on start cutscene in the scene manager , the cursor , inventory and menu screen disappear when playing the game and nothing works.

I am using Unity 2019.2.17f1 and AC version 1.70.2

Thanks in advance for any help.

Comments

  • I have a sound clip that I want to play as ambience in the scene. However I can't get it to play on a loop. I have tried to play it with sound:play ambience , and also sound:play , both with "loop" checked but both times it plays once in the scene and then stops.

    Both of these methods should be valid, and I can't recreate such an issue with either. The Loop? Action property should be directly tied to the Sound's AudioSource component's Loop Inspector field. If you use the Ambience Action, this will be on the "AmbienceEngine" GameObject that gets spawned in at runtime. What is the state of these Inspectors during gameplay?

    I also have three other wind sound clips playing at random which should also continue to play , but they only seem to play once and then stop

    The ActionList looks correct. There's a couple of ways you can debug ActionLists:

    Firstly, keep the ActionList Editor window open while it's running - a currently-running Action will be highlighted in blue.

    Secondly, check Enable 'AC status' box? at the bottom of the Settings Manager. This will cause all currently-running ActionLists to be listed in the top-left of the Game window.

    What do these two things reveal? Does the ActionList stop unexpectedly? Bear in mind that the ActionList: Run in parallel Action is not necessary, since the Sound: Play ambience Action does not wait until its finished. Just make this Action the first before triggering the Variable: Check random number Action.

    How can I adjust the volume that a sound plays?

    Sound components are, by default, tied to the game's SFX volume - which can be changed by the user in the Options menu. It defaults to 0.9, but you can change this value in the Settings Manager's "Default Options" section.

    Are you trying to raise or lower the volume? The raw audio file should play the sound the loudest you want it to be heard, with the Relative volume? slider being used to lower it if necessary. If it's currently at 0.9, are you saying sounds are inaudible by default? Are you relying on Audio Mixer Groups?

    I added the above action list to the "play on start" action list for the scene , but whenever ANY action list is attached to the play on start cutscene in the scene manager , the cursor , inventory and menu screen disappear when playing the game and nothing works.

    By default, any ActionList will block gameplay while running - so the cursor, in-game menus etc will all disappear while it runs. To allow gameplay while an ActionList runs, just change its Inspector's When running property to Run In Background.

  • @ChrisIceBox thanks, It seems that both the looping issue of the ambiance sound , and the failure of the three other tracks to continue playing randomly was because I had removed the action list from the play on start field because it was stopping gameplay - as a result the action list existed only in the scene with nothing to trigger it but was still playing through once and then stopping when the game was played.
    As soon as I tied the action list to the play on start field again , and changed the inspectors when running property to Run in background as you suggested , everything works fine. Does that sound like what should have happened? Do action lists play once if they exist in the scene without anything to trigger them?
    Thanks very much for your help again.

  • Also , one other issue I have ran into whilst working through your suggestions Chris : The scene I am making is an ambient title screen. When you click the new game button , an animation plays and the game begins. I have used an action list : kill to stop the ambient sounds from playing over the animation when it plays. Using the AC status box at game time shows that the action list is indeed stopped, but the sounds that play in it can still be heard over the animation as it is playing. Any ideas what is going on? I have also tried the action list : pause but I still get the same issue. The fact that the action list has definitely stopped is also verified by the sound actions failing to light up blue once the animation is started.

  • Do action lists play once if they exist in the scene without anything to trigger them?

    No, never. It must have been triggered by some other means.

    Note that assigning an ActionList in the Scene Manager's "On start" Cutscene field is not the only way to have it trigger when a scene begins. You can also attach the Action List Starter component to it and configure it from the Inspector.

    I have used an action list : kill to stop the ambient sounds from playing over the animation when it plays.

    Killing an ActionList won't kill the effects that the ActionList has already had on other objects. You'll need to use the Sound: Play Action - with Sound action set to Stop to stop the audio instead. If you are controlling the sound with Sound: Play ambience Action, though, you'll instead need to use this same Action type to stop ambience sound.

  • No, never. It must have been triggered by some other means.

    That is strange , the action list was created via the create button next to the on start cutscene field in the scene manager and then I removed it from that field when I was having issues with it interrupting gameplay but it would still continue to run at gametime despite there now being nothing apparent to trigger it.

    You'll need to use the Sound: Play Action - with Sound action set to Stop to stop the audio instead.

    I just gave this a try , but the sound object in the sound:play (STOP) component reverts to none at game time... The action list in question that is supposed to be killing the sound exists not in the scene , but in the project asset folder as it is linked to a menu button - could that be the issue? Do I have to use the constant ID that is generated in some way?

    Thanks again

  • Further to the last post , here are some images :

    Here is the end of the action list linked to the menu button that starts off the animation and should kill the four sound objects that are playing :

    And here is the action list that is playing the sound objects:

    Also, here is the buttons action list at gametime with all of the sound objects now missing. Interestingly enough , the sound named sound_Ambient does actually stop , but the other three wind sounds that are playing randomly continue to play. I also tried killing the action list again incase it was resurrecting these sounds but that did not work either :

  • it would still continue to run at gametime despite there now being nothing apparent to trigger it.

    Try duplicating the GameObject and removing the original - that should unset any references made to it.

    Interestingly enough , the sound named sound_Ambient does actually stop , but the other three wind sounds that are playing randomly continue to play

    The GameObject references will be lost if you refer to a scene object via an asset file, but it should be OK so long as the Constant ID values match up. Do the one-off sounds in your scene have ID values of 6806, 6826 and 17796?

    If not, try re-linking them again and making sure to save the scene so that ID numbers are saved.

    Alternatively, you can add a Cutscene to your scene to stop the sounds (so that you don't need to rely on their ID values), and then run the Cutscene from the ActionList Asset file using the ActionList: Run Action.

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.
Do NOT follow this link or you will be banned from the site!