Clarify rules around which scripts require @tool in Running code in the editor

- Mention that static methods work, but not static variables.
- Emphasize the use of version control due to the lack of undo/redo.
This commit is contained in:
Hugo Locurcio
2025-04-22 14:30:30 +02:00
parent c5da624227
commit ab7c43c899
2 changed files with 28 additions and 6 deletions

View File

@@ -1099,6 +1099,8 @@ Member variables are initialized in the following order:
To fix this, move the ``_data`` variable definition above the ``a`` definition
or remove the empty dictionary assignment (``= {}``).
.. _doc_gdscript_basics_static_variables:
Static variables
~~~~~~~~~~~~~~~~
@@ -1181,6 +1183,13 @@ A base class static variable can also be accessed via a child class::
B.x = 3
prints(A.x, B.x) # 3 3
.. note::
When referencing a static variable from a tool script, the other script
containing the static variable **must** also be a tool script.
See :ref:`Running code in the editor <doc_running_code_in_the_editor_important_information>`
for details.
``@static_unload`` annotation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~