Up to date

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

VisibleOnScreenNotifier2D

Inherits: Node2D < CanvasItem < Node < Object

Inherited By: VisibleOnScreenEnabler2D

A rectangular region of 2D space that detects whether it is visible on screen.

Description

VisibleOnScreenEnabler2D represents a rectangular region of 2D space. When any part of this region becomes visible on screen or in a viewport, it will emit a screen_entered signal, and likewise it will emit a screen_exited signal when no part of it remains visible.

If you want a node to be enabled automatically when this region is visible on screen, use VisibleOnScreenEnabler2D.

Note: VisibleOnScreenNotifier2D uses the render culling code to determine whether it's visible on screen, so it won't function unless CanvasItem.visible is set to true.

Tutorials

Properties

Rect2

rect

Rect2(-10, -10, 20, 20)

Methods

bool

is_on_screen ( ) const


Signals

screen_entered ( )

Emitted when the VisibleOnScreenNotifier2D enters the screen.


screen_exited ( )

Emitted when the VisibleOnScreenNotifier2D exits the screen.


Property Descriptions

Rect2 rect = Rect2(-10, -10, 20, 20)

  • void set_rect ( Rect2 value )

  • Rect2 get_rect ( )

The VisibleOnScreenNotifier2D's bounding rectangle.


Method Descriptions

bool is_on_screen ( )