0 votes

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?

in Engine by (131 points)
edited by

2 Answers

+1 vote
Best answer

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 getnode("nodename").set("focus/ignore_mouse", true)

by (251 points)
selected by
0 votes

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 dostuffonbuttonpress()
if(!self.is_visible()):
return

by (76 points)
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.