(ANSWERED) How can I hide objects?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By PugMasterPug
:warning: Old Version Published before Godot 3 was released.

How can I hide an object so nothing can interact with it, and later show the object and that it can interact again.
How can I do it with a button, is it the same way or do I need something different so the player can not press it when it is hidden?

:bust_in_silhouette: Reply From: whooshfrosted

I have seen this discussed in the QA before. Their solution was to remove it from the node tree.

With buttons you can also use show()/hide(), and there is an Ignore Mouse property on GUI nodes which can be changed with get_node(“node_name”).set(“focus/ignore_mouse”, true)

:bust_in_silhouette: Reply From: Jams

This is an old post, but I was looking for a way to disable hidden buttons too. I ended up testing for visibility at the beginning of the button’s function and exiting the function if the button is hidden.

func do_stuff_on_button_press()
if(!self.is_visible()):
return