Essentially, I have a singleton which loads all the sound effects at runtime, and assigns them to a constant in a dictionary to be accessed, so like:
###Audio singleton
enum {EXAMPLE}
Sounds = {EXAMPLE : "pathtofile"}
_ready():
Sounds[EXAMPLE] = load(Sounds[EXAMPLE])
func play(sound=EXAMPLE):
player = AudioStreamPlayer.new()
###set bus and stream
stream = Sounds[sound]
player.play()
This is very simplified. In reality I have a directory with multiple sound effects, so each constant corresponds to an array containing like hit1, hit2 and hit3. When the function is called, one will play.
When I run from terminal I get invalid index 0 on array errors. To me that says the files aren't being found or aren't loading into the array for whatever reason. The thing that confuses me is that it works perfectly fine in the editor, so it's something to do with how it's exporting.