Skip to content

Commit e05cebe

Browse files
authored
Document GDScript @export_tool_button (#10338)
* Add @export_tool_button to the documention
1 parent 94d266a commit e05cebe

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tutorials/scripting/gdscript/gdscript_exports.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,24 @@ for a list of parameters and their allowed values.
480480
When using ``@export_custom``, GDScript does not perform any validation on
481481
the syntax. Invalid syntax may have unexpected behavior in the inspector.
482482

483+
``@export_tool_button``
484+
-----------------------
485+
486+
If you need to create a clickable inspector button, you can use ``@export_tool_button``.
487+
This exports a ``Callable`` property as a clickable button. When the button is pressed, the callable is called.
488+
489+
Export a button with label ``"Hello"`` and icon ``"Callable"``. When you press it, it will print ``"Hello world!"``.
490+
491+
::
492+
493+
@tool
494+
extends Node
495+
496+
@export_tool_button("Hello", "Callable") var hello_action = hello
497+
498+
func hello():
499+
print("Hello world!")
500+
483501
Setting exported variables from a tool script
484502
---------------------------------------------
485503

0 commit comments

Comments
 (0)