VisibilityEnabler2D

    Enables certain nodes only when approximately visible.

    The VisibilityEnabler2D will disable , AnimationPlayer, and other nodes when they are not visible. It will only affect nodes with the same root node as the VisibilityEnabler2D, and the root node itself.

    If you just want to receive notifications, use instead.

    Note: For performance reasons, VisibilityEnabler2D uses an approximate heuristic with precision determined by ProjectSettings.world/2d/cell_size. If you need precise visibility checking, use another method such as adding an node as a child of a Camera2D node.

    Note: VisibilityEnabler2D will not affect nodes added after scene initialization.

    Properties

    is_enabler_enabled ( enabler ) const

    set_enabler ( enabler, bool enabled )

    Enumerations

    enum Enabler:

    • ENABLER_FREEZE_BODIES = 1 —- This enabler will freeze RigidBody2D nodes.

    • ENABLER_PAUSE_PARTICLES = 2 —- This enabler will stop nodes.

    • ENABLER_PARENT_PROCESS = 3 —- This enabler will stop the parent’s Node._process function.

    • ENABLER_PARENT_PHYSICS_PROCESS = 4 —- This enabler will stop the parent’s function.

    • ENABLER_PAUSE_ANIMATED_SPRITES = 5 —- This enabler will stop AnimatedSprite nodes animations.

    • ENABLER_MAX = 6 —- Represents the size of the enum.

    If true, nodes will be paused.


    • bool pause_animated_sprites

    Default

    true

    Setter

    set_enabler(value)

    Getter

    is_enabler_enabled()

    If true, nodes will be paused.


    • bool pause_animations

    If true, nodes will be paused.


    • bool pause_particles

    Default

    Setter

    set_enabler(value)

    Getter

    is_enabler_enabled()

    If true, nodes will be paused.


    • bool physics_process_parent

    If true, the parent’s will be stopped.


    • bool process_parent

    Default

    false

    Setter

    set_enabler(value)

    Getter

    is_enabler_enabled()

    If true, the parent’s will be stopped.

    Method Descriptions

    • is_enabler_enabled ( Enabler enabler ) const

    Sets active state of the enabler identified by given constant.