How to check if a window dialog is hidden

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

Can someone Please help

I’m trying to check if a window dialog is hidden because when I press the left mouse button(“shoot”) it plays the shooting sound but if I press the left mouse button inside a window dialog it still make the shoot sound which I dont want.

here is my current code:

func _process(delta):

if Input.is_action_just_pressed(“shoot”):

if how do i check to see if the window dialog is hidden and if so proceed


:bust_in_silhouette: Reply From: paoloforti96

Hi Tyrei.

To achieve that result, you could use the is_visible() method, which is a method common to all canvas items.
So, the condition you wish to write might look like this:

if !my_dialog.is_visible():

Obviosuly you have to substitue “my_dialog” with your dialog node.

To know more about what is possible to do with canvasItems such as PopupDialogs, you could read the documentation. It is well written and quite easy to understand.
Here are the links: