The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

In order to disable touch button I set its visibility to false. It works perfectly except it returns error "not visible in tree". I suspect it happens because it constantly has to check touch button signal to readily deliver as needed. And when it is invisible, code can't check it and returns error. My question is, how do I make it check signal only when it's visible?

Godot version 3.2.3
in Engine by (373 points)

what error are you getting?
which signal are you using?

As far as i know its not possible for an invisible node to receive touch events or broadcast such signals

Thank you for the reply!

Type: TouchScreenButton

Signal: onbutton_pressed()

Error (when invisible):
E 0:00:15.357 _input: Condition "!is_visible_in_tree()" is true. <C++ Source> scene/2d/touch_screen_button.cpp:201 @ _input() <Stack Trace> @ _process()

Again, what I suspect is that it is constantly under check, and when it doesn't see it (if it is invisible) it throws error message. But the game doesn't crash or anything, it works fine. But debugger shows hundreds of these errors (probably every frame?)

I see the infamous TouchScreenButton rears it head again. Not sure what that button is supposed to do but i'll recommend you use any other button under Control > BaseButton instead. To directly answer your question do the check for if is_inside_tree(): or if visible(): inside your signal call though i suspect something entirely different is happening here.

Your suspicions are probably true. It may have something to do with the stuff it has to do when signal is out, and not the signal itself. Maybe I over-complicated stuff. To understand it I'll create a new project to test it out from the ground up and let you know. Thank you bud!

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.