+6 votes

I have added a OGG kind sound in my game. It will play once when user Tap on mobile screen. But the problem is OGG sound gets looped.

Here is the code to play the sound

$AudioStreamPlayer2D.playing = true

How to avoid looping. I want the sound to be played once.

in Engine by (113 points)

2 Answers

+16 votes
Best answer

You probably imported the sound with Loop turned on. To fix it..

  • Select the sound file in the FileSystem tab in Godot
  • Go to the Import tab (next to the Scene tab)
  • Uncheck Loop
  • Click the Reimport button
by (16,664 points)
selected by

Exactly what am looking for

Woow thank you

Oh my gosh thank you so much. So simple!!! I owe you a coffee, jgodfrey.

Ohhhh my, thank yo sooooooo much hahahaha

+4 votes

In the file system window where you usually get a view of all your files, you just have to select the .ogg file and then go above to the Scene View. On it's right you will see import Tab. Click on it and then there will be many options, uncheck the Loop and click on Reimport. This should fix your problem.

by (414 points)

Exactly what am looking for

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.