mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-03 05:48:42 +03:00
Fix references to the @tool annotation
This commit is contained in:
@@ -167,7 +167,7 @@ To create a new node type, you can use the function
|
||||
:ref:`class_EditorPlugin` class. This function can add new types to the editor
|
||||
(nodes or resources). However, before you can create the type, you need a script
|
||||
that will act as the logic for the type. While that script doesn't have to use
|
||||
the ``@tool`` keyword, it can be added so the script runs in the editor.
|
||||
the ``@tool`` annotation, it can be added so the script runs in the editor.
|
||||
|
||||
For this tutorial, we'll create a button that prints a message when
|
||||
clicked. For that, we'll need a script that extends from
|
||||
|
||||
@@ -36,7 +36,7 @@ use cases:
|
||||
How to use it
|
||||
-------------
|
||||
|
||||
To turn a script into a tool, add the keyword ``@tool`` at the top of your code.
|
||||
To turn a script into a tool, add the ``@tool`` annotation at the top of your code.
|
||||
|
||||
To check if you are currently in the editor, use: ``Engine.is_editor_hint()``.
|
||||
|
||||
@@ -351,6 +351,6 @@ If you are using :ref:`EditorScript<class_EditorScript>`:
|
||||
.. warning::
|
||||
|
||||
Using ``@tool`` improperly can yield many errors. It is advised to first
|
||||
write the code how you want it, and only then add the ``@tool`` keyword to
|
||||
write the code how you want it, and only then add the ``@tool`` annotation to
|
||||
the top. Also, make sure to separate code that runs in-editor from code that
|
||||
runs in-game. This way, you can find bugs more easily.
|
||||
|
||||
Reference in New Issue
Block a user