Download

Audio Cue / Playlist with string

Been playing around with Unreal Engine after some time away, and a lot of stuff has changed. I was looking at going after the following:

  • Player loads the main menu to the game, which would display all menu options [done]
  • Music playlist would start playing a random song (currently, I have this setup in a cue just picking a random song)
  • Would display a widget in the bottom right showing the name of the song.

Issues I’m having: It appears that the music is random based on each time you re-open the game, and it just keeps looping that one song. How would I go about getting a TRUE random. (Once a song is finished it cycles through the list again)

Next: To my understanding of how others have tried to achieve getting the song name, the simple way would just be to insert these as strings, attached to each file somehow, and it would fetch the song name string associated to that song. The question is, how?

I’ve thought about going at this with level blueprints, or just putting a sound cue in the position of where the player start is on the map. But for the music to display the actual title that I attach to the string, what would be the best way? I’ve thought about arrays, etc. But don’t really have a solid direction to go in to where I can actually assign a string property to each song in the randomized list of the sound cue. Then I could just use get/set on that string as a variable.

Any help would be appreciated. I sort of found one solution, but I can tell you right now it’s an extremely sloppy way of doing it, which is utilizing Random Integer in Range and Switch on Int and even though I’m learn sort of learning different methods I can use, I can tell you right now, this is NOT efficient code. So I’d like the public’s view on what a proper method would be and what I can do to make this utilizing features I may not know of yet.

Hi Richard,

Did you ever find a solution to this question?