0 votes
extends AudioStreamPlayer2D

 func _process(_delta):
if Input.is_action_just_pressed("ui_accept"):
    play()
func _on_PressEnter_finished():
 stop()

Even with the func _on_PressEnter_finished, It still loops!

Godot version 3.5
in Engine by (14 points)

Has the file been imported with Loop? Select the file in the filesystem window then check the import window.

You wouldn't need to call stop after playback is finished anyway (as it has already stopped).

To add petermoyle's comment, .mp3 and .ogg files are imported with loop enabled by default (while .wav has it disabled). You can change default for new files on import tab as well. The import tab is found next to scene hierarchy tab.

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 [email protected] with your username.