Skip to content

Commit 244b252

Browse files
explain that @export loads resources when script instances are loaded
1 parent b66dc5a commit 244b252

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tutorials/scripting/gdscript/gdscript_exports.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,15 @@ Therefore, if you specify an extension of Resource such as:
244244
The drop-down menu will be limited to AnimationNode and all
245245
its derived classes.
246246

247-
It must be noted that even if the script is not being run while in the
248-
editor, the exported properties are still editable. This can be used
249-
in conjunction with a :ref:`script in "tool" mode <doc_gdscript_tool_mode>`.
247+
One consideration in using ``@export`` variables for classes that
248+
derive from :ref:`Resource <class_Resource>` is that it loads the
249+
resource when the instance of the script is loaded. This is often
250+
desirable as you'll likely want to use that resource directly in
251+
your script. However, if the resource in question is a large
252+
resource commonly loaded during a game's loading screen (like a
253+
:ref:`PackedScene <class_PackedScene>` containing a whole level),
254+
it may be desirable to use ``@export_file`` so you have the file
255+
path to the resource file and can load it manually when you need it.
250256

251257
Exporting bit flags
252258
-------------------

0 commit comments

Comments
 (0)