+1 vote

I've gotten a singleton named music. How do I make so, during the scene named "Menu".
During this scene I dont want the singleton to play. Its a loop btw
Any way to do that?

in Projects by (63 points)
edited by

When is it suppose to play? Is it suppose to play once?

Its suposed to loop in all of the other scenes, exept this one and a few more

If it's not suppose to play for the "Menu" scene, then have the scene switching code tell the audio singleton which scene is going to be loaded. The audio singleton acts based upon which scene it is told.

To prevent it from looping (at least when you don't want it to loop) use something like this:

if scene == "Menu":
   music.get_stream().set_loop(false)

Or more directly:

if scene == "Menu":
  music.stream.loop = false

if scene is not a valid argument as far as I know

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 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.

Categories