Table of Contents

Class VisibleOnScreenNotifier2D

Namespace
Godot
Assembly
GodotSharp.dll

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 ScreenEntered signal, and likewise it will emit a ScreenExited 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 Visible is set to true.

public class VisibleOnScreenNotifier2D : Node2D, IDisposable
Inheritance
VisibleOnScreenNotifier2D
Implements
Derived
Inherited Members

Constructors

VisibleOnScreenNotifier2D()

public VisibleOnScreenNotifier2D()

Properties

Rect

The VisibleOnScreenNotifier2D's bounding rectangle.

public Rect2 Rect { get; set; }

Property Value

Rect2

Methods

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

IsOnScreen()

If true, the bounding rectangle is on the screen.

Note: It takes one frame for the VisibleOnScreenNotifier2D's visibility to be determined once added to the scene tree, so this method will always return false right after it is instantiated, before the draw pass.

public bool IsOnScreen()

Returns

bool

Events

ScreenEntered

Emitted when the VisibleOnScreenNotifier2D enters the screen.

public event Action ScreenEntered

Event Type

Action

ScreenExited

Emitted when the VisibleOnScreenNotifier2D exits the screen.

public event Action ScreenExited

Event Type

Action