Doc: Explain using `_var` suffix for var properties

This commit is contained in:
Serhii Snitsaruk 2024-03-21 15:16:27 +01:00
parent 6c8045b280
commit 94a277ef9d
No known key found for this signature in database
GPG Key ID: A965EF8799FFEC2D
2 changed files with 10 additions and 2 deletions

View File

@ -20,6 +20,8 @@ More on task types you can read in the :ref:`introduction`.
**🛈 Note:** To help you write new tasks, you can add a script template to **🛈 Note:** To help you write new tasks, you can add a script template to
your project using “Misc → Create script template” menu option. your project using “Misc → Create script template” menu option.
Using the :ref:`Blackboard<class_Blackboard>` is covered in :ref:`accessing_blackboard`.
Task anatomy Task anatomy
------------ ------------

View File

@ -10,6 +10,8 @@ including objects and resources.
Using the :ref:`Blackboard<class_Blackboard>`, you can easily share data in your behavior trees, making the tasks in the behavior tree more flexible. Using the :ref:`Blackboard<class_Blackboard>`, you can easily share data in your behavior trees, making the tasks in the behavior tree more flexible.
.. _accessing_blackboard:
Accessing the Blackboard in a Task Accessing the Blackboard in a Task
---------------------------------- ----------------------------------
@ -31,9 +33,13 @@ Here's an example of how you can interact with the :ref:`Blackboard<class_Blackb
# Check if the "speed" variable exists: # Check if the "speed" variable exists:
if blackboard.has_var(speed_var): if blackboard.has_var(speed_var):
# ... # ...
..
**🛈 Note:** The variable doesn't need to exist when you set it. It is recommended to suffix variable name properties with ``_var``, like in the example above, which enables the
inspector to provide a more convenient property editor for the variable. This editor
allows you to select or add the variable to the blackboard plan, and provides a
warning icon if the variable does not exist in the blackboard plan.
**🛈 Note:** The variable doesn't need to exist when you set it in code.
.. _editing_plan: .. _editing_plan: