Hi, for some reason in my project when I reload an scene, the audio stops working:
https://www.youtube.com/watch?v=5W4jNN3zqdI
Here's an example of the bug.
Not sure why it happens and if there's a fault of my code, since when I reset the game, the sound keeps working.
Wooble Booble.tar.gz
I add my project files so you can test the project.
Which Godot version are you using?
Which Godot version are you using?
3.1 stable
I think I may have figured out what you did wrong. It's not an issue with the editor, but when you change scenes you have start the audio again. See here:
func ChangeScene():
get_tree().change_scene("res://Scenes/Level.tscn")
$Select.play()
That works for me, but if it doesn't work for you then tell me, and I can keep looking for solutions. In the future, it might also be a good idea to post bugs in your code on Godot's questions and answers forum as it is meant for these sort of questions. If their really is a bug in the editor, and you post to this forum you'll find out soon enough and you can open an issue here.
Hope this helps!
I think I may have figured out what you did wrong. It's not an issue with the editor, but when you change scenes you have start the audio again. See here:
func ChangeScene(): get_tree().change_scene("res://Scenes/Level.tscn") $Select.play()That works for me, but if it doesn't work for you then tell me, and I can keep looking for solutions. In the future, it might also be a good idea to post bugs in your code on Godot's questions and answers forum as it is meant for these sort of questions. If their really is a bug in the editor, and you post to this forum you'll find out soon enough and you can open an issue here.
Hope this helps!
yeah, I was guessing my issue lied because I stopped the audio when reloading the scene.
Thanks, I'll take into account your advice.
BTW How do I restart the audio engine?
All you have to do is add $Select.play() to your ChangeScene() function and it'll restart the audio
All you have to do is add
$Select.play()to yourChangeScene()function and it'll restart the audio
Thanks, I guess I just need to restart the audio engine.
Closing my issue I guess.
All you have to do is add
$Select.play()to yourChangeScene()function and it'll restart the audio
For some reason it doesn't work, I'm sure my issues lies that the audio engine somehow get's paused when I paused the game at the end of the level transition.
I think I've found it.
func StartGame():
$Select.play()
#yield($Select, "finished")
score = 0
get_tree().change_scene("res://Scenes/Level.tscn")
scoretween = find_node("Root/GUI/ScoreTween")
scorelabel = find_node("Root/GUI/Score")
Somehow a node containing the sound and a yield condition to wait until the sound finishes before changing scenes, just may switch the scene and hung the audio engine somehow.
I believe this is what happens, maybe another dev could test my idea and see if is a real engine bug, like switching scenes with a yield condition make the audio to hung.
Ok, so I found the issue, I set the AudioStreamPlayer of the sounds to Pause mode Process and they worked fine, seems like when pausing a game tree and swapping scenes somehow makes the audio to hung.
At least that's what I'm able to understand what's happening.
Would be nice to see a real dev opinion.
Would be nice to see a real dev opinion.
Real dev here ( 汀掳 蜏蕱 汀掳)
This is a bug. I haven't managed to pinpoint it, but the direct cause seems to be that you are pausing the game inside level's ready. If you comment this line, the issue doesn't happen.
But what's actually weird, it randomly works. When I run the game, it almost always hangs all the audio after pressing start (and by hangs audio, I mean completely no sound, nothing). However, it seems to work 1/20 of the times and also it's always ok when I double-press start. So yeah, this shouldn't happen.
This still keeps happening, but in my case changing the scene actually removes all audio nodes from the scene.