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 )

Member Variables

  • bool fixed_process_parent
  • bool freeze_bodies
  • bool pause_animated_sprites
  • bool pause_animations
  • bool pause_particles
  • bool process_parent

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_PAUSE_ANIMATED_SPRITES = 5
  • 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 = 6

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.