0
\$\begingroup\$

I'm confused about the use of the Visibility enabler node in Godot. I've read the documentation and tried it out both stand-alone and as a child without success.

I set the parent to print a String during its _process function. Despite adding the enabler, it continued to print despite being off screen.

How do I set it up so that It actually disables anything?

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

I think what you disabled was the canvas visibility. That just disables the render's process for the nodes and its childs. If you really want to stop the _process(delta) method. You must find the Stop property, which by default is inherited, and set it to stop.

You can also stop the call of process by setting set_process to false through the script.

\$\endgroup\$
1
  • \$\begingroup\$ I'm sorry, disabling canvas visibility disables process for just any node or children of the enabler? \$\endgroup\$ Mar 31, 2019 at 1:02
1
\$\begingroup\$

Read the documentation on VisibilityEnabler again:

The VisibilityEnabler will disable RigidBody and AnimationPlayer nodes when they are not visible. It will only affect other nodes within the same scene as the VisibilityEnabler itself.

It has nothing to do with _process.


If you want to disable _process, you can use set_process(false) on whatever Node you want to disable it (you can also disable other methods), which you might do from a script attached to a VisibilityNotifier handling its own signals.

Sadly we cannot fully disable a script in Godot 3.x. In Godot 4.x you would use process_mode for that. The equivalent of process_mode in Godot 3.x is pause_mode but there isn't an option to always stop (The "Stop" option makes the Node stop when the scene tree is paused).


For reference in Godot 4 the role of VisibilityEnabler is taken by VisibleOnScreenEnabler3D, and the role of VisibilityNotifier is taken by VisibleOnScreenNotifier3D, and of course there are 2D counterparts as well.

Yes, I see this is an old question.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .