VisibilityEnabler2D

Inherits: VisibilityNotifier2D < Node2D < CanvasItem < Node < Object

Category: Core

Brief Description

Enable certain nodes only when visible.

Member Functions

bool is_enabler_enabled ( int enabler ) const
void set_enabler ( int enabler, bool enabled )

Numeric Constants

  • ENABLER_FREEZE_BODIES = 1 — This enabler will freeze RigidBody2D nodes.
  • ENABLER_PAUSE_ANIMATIONS = 0 — This enabler will pause AnimationPlayer nodes.
  • ENABLER_PAUSE_PARTICLES = 2 — This enabler will stop Particles2D nodes.
  • ENABLER_PARENT_PROCESS = 3 — This enabler will stop the parent’s _process function.
  • ENABLER_PARENT_FIXED_PROCESS = 4 — This enabler will stop the parent’s _fixed_process function.
  • ENABLER_MAX = 5

Description

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

Member Function Description

  • bool is_enabler_enabled ( int enabler ) const

Returns whether the specified enabler was set to true or not.

  • void set_enabler ( int enabler, bool enabled )

Set an enabler to true for all nodes of its type to be disabled when the VisibilityEnabler2D is not in view. See the constants for enablers and what they affect.