0 votes

Hello, I have been creating a "Scene Switcher" recently, which works for the most part. Everything in the code works, however in the new instanced scene I can't click on any options in the pause menu, but I can open and close the menu with the key I've mapped to it. I also have a checkbox in the new scene which I can't click as well. I'm very close to having this work, but the scene is essentially frozen. Not sure what to fix, any help would be greatly appreciated. Here's the code:

change_scene (autoloaded scene):

func change_scene(node, delay = 0.5):
    var pause_menu = preload("res://Scenes//PauseMenu.tscn").instance()

    var n = ResourceLoader.load(node)

    yield(animation_player, "animation_finished")


    var new_scene = n.instance()

    yield(animation_player, "animation_finished")



The PauseMenu (separate scene):

func _ready():

func _physics_process(delta):
    if $VBoxContainer/Map.is_hovered() == true:
    if $VBoxContainer/Options.is_hovered() == true:
    if $VBoxContainer/Quit.is_hovered() == true:

func _input(event):
    if event.is_action_pressed("PauseMenu"):
        get_tree().paused = not get_tree().paused
        visible = not visible

func _on_Resume_pressed():
    get_tree().paused = not get_tree().paused
    visible = not visible

func _on_Quit_pressed():
in Engine by (16 points)

1 Answer

0 votes

You're adding the pause_menu after the new_scene.¹ Assuming the PauseMenu is a Control-node as well, it'll consume all input events, thus your buttons don't react.

On an unrelated note: Paths tolerate double slashes, but don't require them (other than in the beginning). So "res://Scenes/PauseMenu.tscn" is the same as:

# and so on...

Also what you're passing to change_scene isn't a node but a path.

¹ However, I'm not sure why... Seems to have nothing to do with changing scenes?

by (10,580 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.