0 votes

I'm trying to make it so that when I press a button, in this case the continue button, It would hide the panel I have added to the scene and unpause the game. Right now I can bring up the panel or menu in this case but I have no idea how to allow all my scenes to hide the panel once we press continue. The way I have it coded is shown below but that's only for one scene which it works fine for that scene but It won't for the others. The reason is because I only get the node for that scene but I have no idea how to get it for multiple scenes and access the instance from each depending on the level we are on.

Scene Hierarchy for scene that is being instanced:

+Menu(Panel)
  ++Label
  ++VBoxContainer
       +++ContinueButton(Button)
       +++ExitButton(Button)

-The Menu Instance scene is in each Level(Main Scene) which is the same for all levels:

+ROD_Awakening(Extends Node)
       ++Menu(Panel[Instanced])
       ++Other nodes, ect...

Code(works but for only whatever scene we put in quotes):

func _on_ContinueBtn_pressed():

    #Get the root node to get to parent QuickMenu to hide it if we continue and check to see if its already showing to hide


    if get_tree().get_root().get_node("ROD_Awakening/QuickMenu").visible:
        get_tree().get_root().get_node("ROD_Awakening/QuickMenu").hide()
        get_tree().paused = false

    pass 
in Engine by (35 points)

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