Yeilding makes audio stutter badly.

CeakCeak Posts: 38Member
edited July 2 in Audio

I have a a button setup to play a sound when activated but if I yield to finish the sound before switching the scene it stutters the wav. Not sure how to fix this.

func _process(delta: float) -> void:
    if $RayCast2D.is_colliding():
        Sfx.get_node("Explode").play()
#       yield(Sfx.get_node("Explode"), "finished")
        get_tree().change_scene("res://Scenes/World.tscn")

commenting it out the sound plays just fine, but will immediately switch scenes.


Tags :

Best Answer

  • CalinouCalinou Posts: 452
    edited July 3 Accepted Answer

    Does this occur if you use another method to delay the scene change (such as a signal connection to a method instead of yield())?

    You can also try using a Timer node.

Answers

  • CalinouCalinou Posts: 452Admin Godot Developer
    edited July 3 Accepted Answer

    Does this occur if you use another method to delay the scene change (such as a signal connection to a method instead of yield())?

    You can also try using a Timer node.

  • CeakCeak Posts: 38Member

    Sorry for the super slow response. I have been swamped and unavailable. The timer node seems to have worked, clicked no accidently. Thank you for the reply.

  • MegalomaniakMegalomaniak Posts: 2,785Admin

    I've reset it.

  • CeakCeak Posts: 38Member

    Thank you.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file