How to load Music tracks from a folder to an array in a autoload

Godot Version



Hello, i am trying to load multiple music tracks i made into an array, i dont know how to do that, or even if it is possible. i would like the array to be type “AudioStream” so i can then choose which element of the array to play using my musicManager autoload.

You can do

@export var MusicTracks: Array[AudioStream]

And how can i load the different tracks from the project files into that array?

Create a scene with AudioStreamPlayer as root node.

In the inspector you can drag your music into the array. @export make variables show up in the inspector.

Autoload the scene you created.

Isn’t there a way to get the track from the project folders directly?