0 votes

I have the music in the singleton playing, but when I change the scene the music hangs (makes "trrutrrutrrutrrutrrutrrutrru")

in Engine by (20 points)

That shouldn't happen. But without knowing your code that's impossible to fix. Can you upload an example project? The fact that it's making "trrutrrutrrutrrutrrutrrutrru" is sadly not telling anyone what you're doing wrong there... ;)

I do this in the singleton

**func start_music():**
    # if a music is playing, remove it
    if music_player != null:

    # play the new song
    music_player = play_sound_effect(current_music)

**func scene_changer(next_scene, avoid_load=false):**
    times.append(["scene_changer", OS.get_time(), next_scene])

    # this function controls how scenes are changed
    if resumable_scenes.find(next_scene) > resumable_scenes.find(resume_scene):
        resume_scene = next_scene

    # save the changes to the game play

    if get_tree().get_current_scene().get_name() in ["Loading", "Earthquakes2", "House2"]:
        avoid_load = true

    if scenes_path[next_scene]["has_loading"] and not avoid_load:
        scene_to_load = next_scene
        if not get_tree().change_scene(scenes_path["Loading"]["path"]) == 0:
            logger.error("It was not possible to change the scene")

        scene_to_load = ""
        if not get_tree().change_scene(scenes_path[next_scene]["path"]) == 0:
            logger.error("It was not possible to change the scene"

on this link you can hear the problem: https://photos.app.goo.gl/XtpADqHWmaxMnm177

When and how often is start_music called? What does play_sound_effect do? What happens during save_game? The code you provided looks fine, so the problem likely stems from some of the parts you've omitted here. Of course it might also be a bug in the engine, I cannot rule that out completely.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.