Random beginner-question #9: Button is there, only not visible

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By pferft

Hi everyone,

tapping on the “outside-button” opens a popup. The “inside-button” within that popup closes the popup. Now, tapping on the “outside-button” again opens the popup again just as it should, but the “inside-button” within isn’t shown anymore… it’s there – I can close the popup again – but it’s not visible (unless I click at its empty spot, because its click-animation is then shown again anyway).

The “inside-button” is a separately created scene I then put into the popup-scene via “Instance Child Scene”.
Of course it should appear every time I re-open the popup. What could be the problem? Any suggestions?

Apparently adding an animation to the “inside-Button” and triggering it when opening the popup does the trick. The weird thing is that the animation-state of the button at popup-closing will be remembered and displayed at next popup-opening… so, for example, if the button is supposed to fade in at popup-opening, it should animate to invisible at closing to avoid unpleasant “flickering” for a frame or so at opening again.
I wonder why it doesn’t start at its supposed “original point zero” anytime I re-open the popup… is there any way to tell the button to “reset” at closing?

:bust_in_silhouette: Reply From: NotNEo


I don’t know if you have the issue but if you do I hope I can help.
At the first part of the text you mentioned that the “inside-button” would not appear again and again.
This is an easy fix: There is a popup in godot called “Confirmation popup” (or similar to this) where there is an ‘ok’ button inside the popup. This way you don’t need that separately created scene. You mentioned in your text that you achieved this by adding an animation to that scene. By using the method I wrote yu can get rid of the animation, this way your scene structure and script will be more readable.

Hi NotNEo,
that’s the ConfirmationDialog, right? An interesting Node, thanks for your suggestion!

pferft | 2021-10-06 16:02