0 votes

A pressed() signal on a button has this code:

if get_tree().current_scene.filename == "res://Scene1.tscn":

The sound doesn't always plays when pressing a button and changing the scene.

Godot version 3.4
in Engine by (68 points)

1 Answer

0 votes

inside _ready() and call the _ready() in the pressed() signal.... and check what does it print: does it only sometimes print the Scene1 or always? If it is always Scene1, then there is something wrong with the sound path. If it isn't always Scene1, then there is something wrong with the code which switches to that scene.


func _ready():

func pressed()
>if get_tree().current_scene.filename == etc......
by (18 points)
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.