Hi everyone!
First time doing this so please be gentle
I have a day night cycle set up and I am wanting to add general forest noises to the day (Birds) and general night noises to the night (Crickets, frog, ect.) however my current setup plays correctly (day sounds come in during day and night sounds come in during night at the times I have specifed) but doesnât stop when the other sound comes in so I have day sounds overlapping with night sounds. I have tried searching for a way to stop one if the other plays but havent come up with anything. I am a novice with unreal so pictures and simple explantions would be appreciated
Thank you!
Picture of my BPs attached
What youâll want to do is make variables out of the Play2DSound. right-click on the sound input on the node and click âPromote to variableâ. Then what you can do with this variable is to stop the audio before it resets the DoOnce node. Give it a try.
Thanks for getting back to me so quickly. I have set up those sounds as variables but how would i go about stopping them before the reset on DoOnce. Thanks again!
Like this:
A lot of people new to the engine do everything on tick. Itâs a habit to break
You could use a timer, which could run once a second instead of every frame to control the time of day.
Yeah definitely use a timer. It would be wasteful to spend every tick on this. And I would just put a stop node after the play sound with the sound used just before. If that doesnât work, maybe you could try adding a delay before the Do Once resets? Maybe the audio is finishing straight away and resetting.
Wow, that is great information, thank you both for getting back to me. One more question if you donât mind, what am I setting the variable type as? I have tried a few things and they donât seem to play nice with the stop node.
On the SpawnSound2d, right click the input pin and âpromote to variableâ.
Tried that and it gives me this.
So you do that on the left to get the right variable type to hold the wave files, do it on the right pin to get the variable type to hold the playing sound which you can call stop withâŚ
Haha I am a lost cause. Thank you so much for all your help with this!