:github_url: hide

.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/limboai/doc_classes/BTInstance.xml.

.. _class_BTInstance:

BTInstance
==========

**Inherits:** 

Represents a runtime instance of a :ref:`BehaviorTree<class_BehaviorTree>` resource.

.. rst-class:: classref-introduction-group

Description
-----------

Can be created using the :ref:`BehaviorTree.instantiate<class_BehaviorTree_method_instantiate>` method.

.. rst-class:: classref-reftable-group

Properties
----------

.. table::
   :widths: auto

   +----------+---------------------------------------------------------------------------+-----------+
   | ``bool`` | :ref:`monitor_performance<class_BTInstance_property_monitor_performance>` | ``false`` |
   +----------+---------------------------------------------------------------------------+-----------+

.. rst-class:: classref-reftable-group

Methods
-------

.. table::
   :widths: auto

   +-------------------------------------+-----------------------------------------------------------------------------------------+
   | ``Node``                            | :ref:`get_agent<class_BTInstance_method_get_agent>`\ (\ ) |const|                       |
   +-------------------------------------+-----------------------------------------------------------------------------------------+
   | :ref:`Blackboard<class_Blackboard>` | :ref:`get_blackboard<class_BTInstance_method_get_blackboard>`\ (\ ) |const|             |
   +-------------------------------------+-----------------------------------------------------------------------------------------+
   | :ref:`Status<enum_BT_Status>`       | :ref:`get_last_status<class_BTInstance_method_get_last_status>`\ (\ ) |const|           |
   +-------------------------------------+-----------------------------------------------------------------------------------------+
   | ``Node``                            | :ref:`get_owner_node<class_BTInstance_method_get_owner_node>`\ (\ ) |const|             |
   +-------------------------------------+-----------------------------------------------------------------------------------------+
   | :ref:`BTTask<class_BTTask>`         | :ref:`get_root_task<class_BTInstance_method_get_root_task>`\ (\ ) |const|               |
   +-------------------------------------+-----------------------------------------------------------------------------------------+
   | ``String``                          | :ref:`get_source_bt_path<class_BTInstance_method_get_source_bt_path>`\ (\ ) |const|     |
   +-------------------------------------+-----------------------------------------------------------------------------------------+
   | ``bool``                            | :ref:`is_instance_valid<class_BTInstance_method_is_instance_valid>`\ (\ ) |const|       |
   +-------------------------------------+-----------------------------------------------------------------------------------------+
   | |void|                              | :ref:`register_with_debugger<class_BTInstance_method_register_with_debugger>`\ (\ )     |
   +-------------------------------------+-----------------------------------------------------------------------------------------+
   | |void|                              | :ref:`unregister_with_debugger<class_BTInstance_method_unregister_with_debugger>`\ (\ ) |
   +-------------------------------------+-----------------------------------------------------------------------------------------+
   | :ref:`Status<enum_BT_Status>`       | :ref:`update<class_BTInstance_method_update>`\ (\ delta\: ``float``\ )                  |
   +-------------------------------------+-----------------------------------------------------------------------------------------+

.. rst-class:: classref-section-separator

----

.. rst-class:: classref-descriptions-group

Signals
-------

.. _class_BTInstance_signal_freed:

.. rst-class:: classref-signal

**freed**\ (\ ) :ref:`🔗<class_BTInstance_signal_freed>`

Emitted when the behavior tree instance is freed. Used by debugger to unregister.

.. rst-class:: classref-item-separator

----

.. _class_BTInstance_signal_updated:

.. rst-class:: classref-signal

**updated**\ (\ status\: ``int``\ ) :ref:`🔗<class_BTInstance_signal_updated>`

Emitted when the behavior tree instance has finished updating.

.. rst-class:: classref-section-separator

----

.. rst-class:: classref-descriptions-group

Property Descriptions
---------------------

.. _class_BTInstance_property_monitor_performance:

.. rst-class:: classref-property

``bool`` **monitor_performance** = ``false`` :ref:`🔗<class_BTInstance_property_monitor_performance>`

.. rst-class:: classref-property-setget

- |void| **set_monitor_performance**\ (\ value\: ``bool``\ )
- ``bool`` **get_monitor_performance**\ (\ )

If ``true``, adds a performance monitor for this instance to "Debugger->Monitors" in the editor.

.. rst-class:: classref-section-separator

----

.. rst-class:: classref-descriptions-group

Method Descriptions
-------------------

.. _class_BTInstance_method_get_agent:

.. rst-class:: classref-method

``Node`` **get_agent**\ (\ ) |const| :ref:`🔗<class_BTInstance_method_get_agent>`

Returns the agent of the behavior tree instance.

.. rst-class:: classref-item-separator

----

.. _class_BTInstance_method_get_blackboard:

.. rst-class:: classref-method

:ref:`Blackboard<class_Blackboard>` **get_blackboard**\ (\ ) |const| :ref:`🔗<class_BTInstance_method_get_blackboard>`

Returns the blackboard of the behavior tree instance.

.. rst-class:: classref-item-separator

----

.. _class_BTInstance_method_get_last_status:

.. rst-class:: classref-method

:ref:`Status<enum_BT_Status>` **get_last_status**\ (\ ) |const| :ref:`🔗<class_BTInstance_method_get_last_status>`

Returns the execution status of the last update.

.. rst-class:: classref-item-separator

----

.. _class_BTInstance_method_get_owner_node:

.. rst-class:: classref-method

``Node`` **get_owner_node**\ (\ ) |const| :ref:`🔗<class_BTInstance_method_get_owner_node>`

Returns the scene ``Node`` that owns this behavior tree instance.

.. rst-class:: classref-item-separator

----

.. _class_BTInstance_method_get_root_task:

.. rst-class:: classref-method

:ref:`BTTask<class_BTTask>` **get_root_task**\ (\ ) |const| :ref:`🔗<class_BTInstance_method_get_root_task>`

Returns the root task of the behavior tree instance.

.. rst-class:: classref-item-separator

----

.. _class_BTInstance_method_get_source_bt_path:

.. rst-class:: classref-method

``String`` **get_source_bt_path**\ (\ ) |const| :ref:`🔗<class_BTInstance_method_get_source_bt_path>`

Returns the file path to the behavior tree resource that was used to create this instance.

.. rst-class:: classref-item-separator

----

.. _class_BTInstance_method_is_instance_valid:

.. rst-class:: classref-method

``bool`` **is_instance_valid**\ (\ ) |const| :ref:`🔗<class_BTInstance_method_is_instance_valid>`

Returns ``true`` if the behavior tree instance is properly initialized and can be used.

.. rst-class:: classref-item-separator

----

.. _class_BTInstance_method_register_with_debugger:

.. rst-class:: classref-method

|void| **register_with_debugger**\ (\ ) :ref:`🔗<class_BTInstance_method_register_with_debugger>`

Registers the behavior tree instance with the debugger.

.. rst-class:: classref-item-separator

----

.. _class_BTInstance_method_unregister_with_debugger:

.. rst-class:: classref-method

|void| **unregister_with_debugger**\ (\ ) :ref:`🔗<class_BTInstance_method_unregister_with_debugger>`

Unregisters the behavior tree instance from the debugger. This is typically not necessary, as the debugger will automatically unregister the instance when it is freed.

.. rst-class:: classref-item-separator

----

.. _class_BTInstance_method_update:

.. rst-class:: classref-method

:ref:`Status<enum_BT_Status>` **update**\ (\ delta\: ``float``\ ) :ref:`🔗<class_BTInstance_method_update>`

Ticks the behavior tree instance and returns its status.

.. |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.)`
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
.. |void| replace:: :abbr:`void (No return value.)`