0 votes

So visible property is a for godot to know what node will be calculated in screen. It can change through toggle visibility button in scene menu or by .visible property.

Everything that visible will be calculated. (All script and all of it childern nodes)
And if the visiblitity is false then, the script stop working and all of it childerns.

Not like .free() and .queuefree(), where free still in memory but can't accsess anymore and queuefree release from memory. Visible only tell the godot game loop to not calculate and show it to the screen.

Is my understanding is right?

Godot version 3.5.1
in Engine by (61 points)

1 Answer

+2 votes
Best answer

Visibility only allows to a node to display or not his content on screen.
But the code of a node with "visibility == false" will still be executed.


Add a 2d child node to your scene and set his visibility to false.

In this child node add this code:

func _process(delta):
     print ("running....")

Then run the scene, you will see that the hidden node will run the code.

If you want the code to be executed only when the node is visible you can use this:

func _process(delta):
    if self.visible:
        print ("running....")


by (95 points)
selected by

Ah yes.. I forget. And yes the _ready and _process function still being called.

But I think, I am confusing my case with general nodes. TouchScreenButton node if visible = false doesn't detect if the screen being touched.

Sorry for late reply. Thank you verry much btw.

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.