This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I have a scene created in Godot 2D, in which I have created also a CanvasLayer ( that contains a Control with a Container and buttons) . This Control script is not visible during the game.

After I finish beating the enemy I want to make visible my CanvasLayer/Control , while the main game is put on pause.

So, I beat the enemy:
I have a global variable that is put on true, then I acces funconWorld10_acces(). And this is the code of my control. The game is paused, ( which is what I wanted) , but when I click on my buttons nothing happens.

extends Control

func ready():

func physicsprocess(delta):
if $MarginContainer/CenterContainer/VBoxContainer/Start.ishovered()== true:
if $MarginContainer/CenterContainer/VBoxContainer/Quit.ishovered()== true:

func onWorld10acces():
tree().paused= not get_tree().paused
visible = not visible

func onStartpressed():
tree().paused= not gettree().paused

func onQuitpressed():

Do you know how I can resolve this?

in Engine by (22 points)

2 Answers

+2 votes
Best answer

By default, nodes will not be able to respond when the game is in a paused state. You can selectively change that as necessary. Just change the Pause property (in the inspector for the node(s) in question). The value defaults to Inherit, which causes them to react just like their parent. Setting the value to Process will allow the node to continue to process events even while the game is paused...

by (22,704 points)
selected by
0 votes

Could you put your code under code tags so it is readable? Impossible to read well like this.

by (380 points)

While I agree with your statement, this should be posted as a Comment rather than an Answer (which, it obviously is not)... ;^)

You're right, my bad. Sorry, but just started here yesterday. Kinda obvious what you point out, but I didn't realize, so thanks. Will keep it in mind for the future :)

Understood - we're all new at some point. Thanks for your understanding and welcome!

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.