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

Hello everyone,

First, I would like to thank all the godot community members for their tools and clear support material.

However, I have a question about the behavior of the pause feature: why are some signals emitted at resuming?

I made a Minimal Working Example to reproduce the behavior that I am talking about. Here is the scene node tree (sorry my godot is in French):

enter image description here

The pause mode of the main Node is "Process", the one of the Area2D is "Stop" and the one of the CollisionShape2D is "Inherit".

The gdscript attached to the Main node is the following:

extends Node2D

func _ready():
    $Area2D.connect("mouse_entered", self, "_on_Area2D_mouse_entered")

func _input(event):
    if event is InputEventKey:
        if event.scancode == KEY_ESCAPE and event.is_pressed():
            get_tree().paused = not get_tree().paused

func _on_Area2D_mouse_entered():
    print("MOUSE_ENTERED")

So:

  • When the mouse enters the CollisionShape2D, an output message "MOUSE_ENTERED" is printed.
  • When the escape button is pressed, the game is paused. In that state, when the mouse enters the CollisionShape2D, nothing is printed.

That's okay, that's cool. However, when the mouse enters the CollisionShape2D at least once during the pause, the message "MOUSE_ENTERED" is printed when resuming (hitting escape again)**, even if the mouse is not in the CollisionShape2D when hitting escape**. Personaly, I find that kind of unexpected...

Do you have any idea about how to prevent "MOUSE_ENTERED" to be printed on resuming? I tried to disconnect the signal during the pause but it is not working...

Thank you for your time and attention,

MetalGanon.

in Engine by (12 points)

My only suggestion would be to disable the Area2D when it's paused and, when unpausing, enable the Area2D.

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