Files
project-thought-experiment/scripts/sound_effect.gd
2024-01-26 00:00:07 +01:00

13 lines
301 B
GDScript

extends AudioStreamPlayer
class_name SoundEffect
@export var audio_library: Array[SoundeffectResource]
func play_key(key: String) -> void:
for res in audio_library:
if res.key == key:
stream = res.audio
play()
return
push_error(key + " is not available in the Audio Library variable")