-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Clarify rules around which scripts require @tool
in Running code in the editor
#10888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Clarify rules around which scripts require @tool
in Running code in the editor
#10888
Conversation
Calinou
commented
Apr 22, 2025
- Mention that static methods work, but not static variables.
- Emphasize the use of version control due to the lack of undo/redo.
- See tutorials/plugins/running_code_in_the_editor godot-docs-user-notes#400 (comment).
… the editor - Mention that static methods work, but not static variables. - Emphasize the use of version control due to the lack of undo/redo.
3ad2eaa
to
ab7c43c
Compare
files without ``@tool``, which means you cannot call methods or reference member | ||
variables from them otherwise. However, since static methods, constants and | ||
enums can be used without creating an instance, it is possible to call them or | ||
reference them from a ``@tool`` script onto other non-tool scripts. One exception to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is onto
instead of on
here what is commonly used in the docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
this are :ref:`static variables <doc_gdscript_basics_static_variables>`. | ||
If you try to read a static variable's value in a script that does not have | ||
``@tool``, it will always return ``null`` but won't print a warning or error | ||
when doing so. This restriction does not apply to static methods, which can be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that static functions can access static variables. Although this is stated above, this exception can be a bit confusing. Is there any way we can clarify this without making the documentation even more complicated? Maybe like this:
when doing so. This restriction does not apply to static methods, which can be | |
when doing so. This restriction does not apply to pure static methods, which can be |