Godot Version
4.2.1
Hi, I’ve been going through a guide that was created by DashNothing in order to learn how to make text-boxes. I’ve taken some aspects into my own understanding as the original project was modified to make the textboxes operate in 3D and draw over most objects through a subviewport. However when trying to make an audio function that seems to play and reinstantiate itself to loop the playback at different pitches it doesn’t seem to play the audio no matter what I do.
I’ve posted some of the relevant code below, I’ve set the subviewport to listen on both 2D and 3D. I’ve tried giving the node a unique reference name and reparenting it. I’ve tried switching the node type from AudioStreamPlayer3D to an AudioStreamPlayer, no go. I’ve tried reformatting the audio file (It’s a .WAV) and I’ve set up a monitor to make sure that it’s not just really quiet, there’s nothing playing.
I don’t think it’s a pipeline issue as I’ve made several other files the same way and they seem to work. I’ve tried adding prints in different sections to see if I could narrow it down to a chunk of code not playing but they all seem to be actually working. It seems like it’s a problem with the viewport listening function and how I’ve got it set up, but I don’t know what.
@onready var mumble: AudioStreamPlayer3D = %TextBoxMumbledep
func populate_bubble(text_to_display: String, speech_sfx: AudioStream):
mumble.stream = speech_sfx
func _display_letter() -> void:
match text[letter_index]:
var new_audio_player = mumble.duplicate()
new_audio_player.pitch_scale += randf_range(-0.1, 0.1)
if text[letter_index] in ["a", "e", "i", "o", "u", "y"]:
new_audio_player.pitch_scale += 0.2
get_tree().root.add_child(new_audio_player)
new_audio_player.play()
print("new audio player instantiated")
await new_audio_player.finished
new_audio_player.queue_free()