:github_url: hide .. Generated automatically by doc/tools/make_rst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the VisibilityEnabler2D.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_VisibilityEnabler2D: VisibilityEnabler2D =================== **Inherits:** :ref:`VisibilityNotifier2D` **<** :ref:`Node2D` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` Enables certain nodes only when approximately visible. Description ----------- The VisibilityEnabler2D will disable :ref:`RigidBody2D`, :ref:`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 :ref:`VisibilityNotifier2D` instead. **Note:** For performance reasons, VisibilityEnabler2D uses an approximate heuristic with precision determined by :ref:`ProjectSettings.world/2d/cell_size`. If you need precise visibility checking, use another method such as adding an :ref:`Area2D` node as a child of a :ref:`Camera2D` node. **Note:** VisibilityEnabler2D will not affect nodes added after scene initialization. Properties ---------- +-------------------------+------------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`freeze_bodies` | ``true`` | +-------------------------+------------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`pause_animated_sprites` | ``true`` | +-------------------------+------------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`pause_animations` | ``true`` | +-------------------------+------------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`pause_particles` | ``true`` | +-------------------------+------------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`physics_process_parent` | ``false`` | +-------------------------+------------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`process_parent` | ``false`` | +-------------------------+------------------------------------------------------------------------------------------+-----------+ Methods ------- +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_enabler_enabled` **(** :ref:`Enabler` enabler **)** |const| | +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_enabler` **(** :ref:`Enabler` enabler, :ref:`bool` enabled **)** | +-------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Enumerations ------------ .. _enum_VisibilityEnabler2D_Enabler: .. _class_VisibilityEnabler2D_constant_ENABLER_PAUSE_ANIMATIONS: .. _class_VisibilityEnabler2D_constant_ENABLER_FREEZE_BODIES: .. _class_VisibilityEnabler2D_constant_ENABLER_PAUSE_PARTICLES: .. _class_VisibilityEnabler2D_constant_ENABLER_PARENT_PROCESS: .. _class_VisibilityEnabler2D_constant_ENABLER_PARENT_PHYSICS_PROCESS: .. _class_VisibilityEnabler2D_constant_ENABLER_PAUSE_ANIMATED_SPRITES: .. _class_VisibilityEnabler2D_constant_ENABLER_MAX: enum **Enabler**: - **ENABLER_PAUSE_ANIMATIONS** = **0** --- This enabler will pause :ref:`AnimationPlayer` nodes. - **ENABLER_FREEZE_BODIES** = **1** --- This enabler will freeze :ref:`RigidBody2D` nodes. - **ENABLER_PAUSE_PARTICLES** = **2** --- This enabler will stop :ref:`Particles2D` nodes. - **ENABLER_PARENT_PROCESS** = **3** --- This enabler will stop the parent's _process function. - **ENABLER_PARENT_PHYSICS_PROCESS** = **4** --- This enabler will stop the parent's _physics_process function. - **ENABLER_PAUSE_ANIMATED_SPRITES** = **5** --- This enabler will stop :ref:`AnimatedSprite` nodes animations. - **ENABLER_MAX** = **6** --- Represents the size of the :ref:`Enabler` enum. Property Descriptions --------------------- .. _class_VisibilityEnabler2D_property_freeze_bodies: - :ref:`bool` **freeze_bodies** +-----------+----------------------+ | *Default* | ``true`` | +-----------+----------------------+ | *Setter* | set_enabler(value) | +-----------+----------------------+ | *Getter* | is_enabler_enabled() | +-----------+----------------------+ If ``true``, :ref:`RigidBody2D` nodes will be paused. ---- .. _class_VisibilityEnabler2D_property_pause_animated_sprites: - :ref:`bool` **pause_animated_sprites** +-----------+----------------------+ | *Default* | ``true`` | +-----------+----------------------+ | *Setter* | set_enabler(value) | +-----------+----------------------+ | *Getter* | is_enabler_enabled() | +-----------+----------------------+ If ``true``, :ref:`AnimatedSprite` nodes will be paused. ---- .. _class_VisibilityEnabler2D_property_pause_animations: - :ref:`bool` **pause_animations** +-----------+----------------------+ | *Default* | ``true`` | +-----------+----------------------+ | *Setter* | set_enabler(value) | +-----------+----------------------+ | *Getter* | is_enabler_enabled() | +-----------+----------------------+ If ``true``, :ref:`AnimationPlayer` nodes will be paused. ---- .. _class_VisibilityEnabler2D_property_pause_particles: - :ref:`bool` **pause_particles** +-----------+----------------------+ | *Default* | ``true`` | +-----------+----------------------+ | *Setter* | set_enabler(value) | +-----------+----------------------+ | *Getter* | is_enabler_enabled() | +-----------+----------------------+ If ``true``, :ref:`Particles2D` nodes will be paused. ---- .. _class_VisibilityEnabler2D_property_physics_process_parent: - :ref:`bool` **physics_process_parent** +-----------+----------------------+ | *Default* | ``false`` | +-----------+----------------------+ | *Setter* | set_enabler(value) | +-----------+----------------------+ | *Getter* | is_enabler_enabled() | +-----------+----------------------+ If ``true``, the parent's :ref:`Node._physics_process` will be stopped. ---- .. _class_VisibilityEnabler2D_property_process_parent: - :ref:`bool` **process_parent** +-----------+----------------------+ | *Default* | ``false`` | +-----------+----------------------+ | *Setter* | set_enabler(value) | +-----------+----------------------+ | *Getter* | is_enabler_enabled() | +-----------+----------------------+ If ``true``, the parent's :ref:`Node._process` will be stopped. Method Descriptions ------------------- .. _class_VisibilityEnabler2D_method_is_enabler_enabled: - :ref:`bool` **is_enabler_enabled** **(** :ref:`Enabler` enabler **)** |const| Returns whether the enabler identified by given :ref:`Enabler` constant is active. ---- .. _class_VisibilityEnabler2D_method_set_enabler: - void **set_enabler** **(** :ref:`Enabler` enabler, :ref:`bool` enabled **)** Sets active state of the enabler identified by given :ref:`Enabler` constant. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`