I've found myself going around in circles with this one. Typically I try to research the issue as much as possible before jumping to the forum to ask questions, but this one has burnt me out.
I have two ambient sound clips of light wind, and several wood creaks and rope creak clips. My goal is to have the wind ambient clips looping constantly, with a fade in and out between the two as they start and stop suddenly. Then I want to randomize the various creak sounds to play throughout as well.
I saw this post and I understand how to use the action editor to randomize the creaks
However, I have found myself going in circles because I simply don't understand how the sounds are actually played through an action list.
Do I add and empty game object and then add an action list component and a play sound action?
Do I add a sound prefab and then add an action component to it?
Or is there another method?
Then I read something about certain sounds causing save issues which confused me more.
Also, can both the constant ambiance from the two wind clips, and the random creak clips be all integrated into one action list, or do they have to have separate ones?
Additionally, I did manage to get the ambient wind clips playing with the above cut scene method to play music, but it played one, followed by the other and then stopped..... I tried looping it by taking the output of the final clips node and plugging it into the first, which I assumed would work, but it just made the game crash.
One final question about action lists. does the final node in the sequence need to be set to "stop" or "continue" after running because that always confuses me.
I'm very new to all this, and Iv'e watched both Chris Burton and Isaac Lundgren's tutorials and read through the manual , but this ones got me stuck
Thanks in advance for any help.
Comments
Essentially, there are three ways of playing sounds:
1) The Sound: Play Action - this plays AudioClips with AC's Sound prefab, which you can create in the Scene Manager. A Sound object can be given an AudioClip to play by simply having it assigned in the AudioSource component, but the Sound: Play Action can optionally set the clip when it runs. You can save the audio playback's state by attaching a Remember Sound component to the Sound object, and optionally have it survive scene changes (though it'll be destroyed in the new scene when it stops playing).
2) The Sound: Play one-shot Action - this plays an AudioClip without the need for a Sound object or AudioSource component. This makes it more convenient to play, but you aren't able to control the audio settings as you would with 1), nor save its playback state.
3) The Sound: Play music Action - this is a separate sound system that handles audio playback automatically, without the need for a Sound object, and also works automatically across scenes. With the exception of crossfading, however only one "track" can play at a time.
The 3D Demo game makes use of method 1) for e.g. the opening cutscene Intro1, and method 2) in the cutscene SkipIntro.
As ActionLists are separate from the objects they affect, you could move all Actions to one - but it may be more convenient to handle the creaks and wind in two separate ones (or at least work on one before incorporating the other).
I suspect that your crash was because you created a looping ActionList that ran indefinitely every frame - the Sound: Play music doesn't wait for the chosen track to finish, so the two looping Actions would have been cycling between each other as fast as your CPU would allow before running out of memory.
Since you need the two tracks to play in an indefinite loop, I wouldn't recommend using the music system - at least not with two tracks like that. You could try editing the wind sounds in e.g. Audacity to add in fade ins/outs directly, and then have an ActionList play one sound (Sound: Play), wait a second or so less than it actually lasts (Engine: Wait), and then fade in/out the new sound/old sound respectively.
About ActionLists: the "Continue" option will only have an effect if it is not the last Action in the sequence - it'll behave like "Stop" otherwise. It is recommended to use the ActionList Editor window over the ActionList Inspector, as that makes it much easier to visualise the flow of Actions.
What is your game's SFX audio set to, and have you marked your Sound object's "Sound type" to match?
The Sound object (in the scene, not the original prefab) should be assigned in the Action. The optional clip field will replace its AudioSource component's Audio clip field. Its not necessary if you want one particular clip to play at that point, which is usually beneficial if you're dealing with 3D audio and want each sound to be positioned correctly.
Your scene should only have one AudioListener component (Unity will complain otherwise), and this is on your MainCamera by default and shouldn't need changing.
The Actions you've described should work, so I'd recommend using Action comments to help debug what's going on. The "cog" icon to the top right of an Action in the ActionList Editor can enable comments, and these can be displayed in the Console (when the Action is run) via an option at the bottom of the Settings Manager. Make use of this to determine if the Sound: Play Actions are being correctly run or not.
However, the recent v1.60 update also includes a new "Ambience track" system, which behaves very similarly to the Music system only for SFX tracks. Tracks can be queued up, crossfaded etc, so you may want to consider using that instead, since it does away with the need for working with Sound objects completely.
Sure - a sizeable manual can be found in the root Adventure Creator directory, and is also available online.
Use the new Sound: Play ambience Action, which is totally separate (but similar in functionality) to Sound: Play music. This is covered in the Manual under Section 5.13, and also listed in the Changelog file.
The example screenshot will play the same subsequent Action (the dialogue) regardless of the chosen random number - the only thing that changes is how long the delay is. As each random sound has its own length, you'd want each of the outputs for the Variable: Check random number to link to their own separate Sound: Play Actions, followed by their own Engine: Wait Actions, which then re-route back to a single, shared Action that loops back to the Variable: Random number Action.
I wasn't saying the ActionLists get added to the Sound object - just that the ActionList (regardless of where it is) can assign a Sound's AudioClip when it runs its Sound: Play Action. See the image I've provided above - here, the same Sound is being played, but with a different clip each time. The ActionList itself can be anywhere in the scene.
As for your ActionList arrangement, there's no technical requirement to have your Sound: Play ambience in a separate ActionList - though it's often easier to break up your ActionLists if they get complex. While each Action output can only connect to one input, the ActionList: Run in parallel Action can be used to run multiple subsequent Actions (or ActionLists) simultaneously.
Sorry for bringing back this topic... needed the same thing...
I think I've made everything works, BUT, I've one problem: the "engine: wait" at the cutscene doesn't allow me to play the game (i.e. cursor is not appearing).
Why so? Looks like everything is stuck waiting for the "engine".
I thought it was some kind of background actions...
Basically I want my cutscene to start by playing music, playing ambience and randomize in loop a thunder sound.
Here a screenshot: https://ibb.co/MnVwDp1
Basically the "thunder" is randomize correctly, but the cursor won't appear...
Why so?
What of your ActionList's properties? You'll need to set its When running field to Run In Background to prevent it from blocking gameplay.
Thanks! It worked! Sorry for the noob question!