Skip to content

Commit 554fc8f

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

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tutorials/scripting/gdscript/gdscript_exports.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,17 @@ It must be noted that even if the script is not being run while in the
248248
editor, the exported properties are still editable. This can be used
249249
in conjunction with a :ref:`script in "tool" mode <doc_gdscript_tool_mode>`.
250250

251+
.. note::
252+
253+
Using ``@export`` variables for :ref:`Resource <class_Resource>` objects
254+
makes them a dependency of the script, meaning that all the resources
255+
referenced by ``@export`` variables are loaded when the scene
256+
containing the script is instantiated. If you want to reference a
257+
:ref:`Resource <class_Resource>` object but load it manually when you need
258+
it (which, for example, is often the case for
259+
:ref:`PackedScenes <class_PackedScene>` containing a whole level), use
260+
``@export_file`` instead.
261+
251262
Exporting bit flags
252263
-------------------
253264

0 commit comments

Comments
 (0)