Up to date

This page is up to date for Godot 4.0. If you still find outdated information, please open an issue.

VisibleOnScreenEnabler2D

Inherits: VisibleOnScreenNotifier2D < Node2D < CanvasItem < Node < Object

Automatically disables another node if not visible on screen.

Description

VisibleOnScreenEnabler2D detects when it is visible on screen (just like VisibleOnScreenNotifier2D) and automatically enables or disables the target node. The target node is disabled when VisibleOnScreenEnabler2D is not visible on screen (including when CanvasItem.visible is false), and enabled when the enabler is visible. The disabling is achieved by changing Node.process_mode.

Properties

EnableMode

enable_mode

0

NodePath

enable_node_path

NodePath("..")


Enumerations

enum EnableMode:

EnableMode ENABLE_MODE_INHERIT = 0

Corresponds to Node.PROCESS_MODE_INHERIT.

EnableMode ENABLE_MODE_ALWAYS = 1

Corresponds to Node.PROCESS_MODE_ALWAYS.

EnableMode ENABLE_MODE_WHEN_PAUSED = 2

Corresponds to Node.PROCESS_MODE_WHEN_PAUSED.


Property Descriptions

EnableMode enable_mode = 0

Determines how the node is enabled. Corresponds to ProcessMode. Disabled node uses Node.PROCESS_MODE_DISABLED.


NodePath enable_node_path = NodePath("..")

  • void set_enable_node_path ( NodePath value )

  • NodePath get_enable_node_path ( )

The path to the target node, relative to the VisibleOnScreenEnabler2D. The target node is cached; it's only assigned when setting this property (if the VisibleOnScreenEnabler2D is inside scene tree) and every time the VisibleOnScreenEnabler2D enters the scene tree. If the path is invalid, nothing will happen.