Dynamically SetSound on one AmbientSound node


Basically I need to play about 20-30+ sounds in the game from one AmbientSound node in the game

So I figured I’ll make an array of sounds and then loop through it as required and invoke PlaySound. But so far it has not worked for me.

For example I am not sure how to initialize the sounds. It seems that I can add AmbientSound to the EventGraph and then I need to invoke SetSound to initialize it, but I can only set one sound to AmbientSound node.

So the question is, how do I dynamically SetSound on one AmbientSound node?

Naturally I wanted to add a bunch of sounds to the array and then loop through it calling play sound as required, but I am not that this is possible.


Ok, I think I got it.

I just made a an array of SoundWave objects and everytime on the event I need I just set the AmbientSound node to the object at the index array and then play. Works like a dream.

Here is my part of the network that does it:

1 Like