@@ -368,6 +368,28 @@ Packed type arrays also work, but only initialized empty:
368
368
@export var vector3s = PackedVector3Array()
369
369
@export var strings = PackedStringArray()
370
370
371
+ ``@export_storage ``
372
+ -------------------
373
+
374
+ By default, exporting a property has two effects:
375
+
376
+ 1. makes the property stored in the scene/resource file (:ref: `PROPERTY_USAGE_STORAGE <class_@GlobalScope_constant_PROPERTY_USAGE_STORAGE >`);
377
+ 2. adds a field to the Inspector (:ref: `PROPERTY_USAGE_EDITOR <class_@GlobalScope_constant_PROPERTY_USAGE_EDITOR >`).
378
+
379
+ However, sometimes you may want to make a property serializable, but not display it
380
+ in the editor to prevent unintentional changes and cluttering the interface.
381
+
382
+ To do this you can use :ref: `@export_storage <class_@GDScript_annotation_@export_storage >`.
383
+ This can be useful for :ref: `@tool <class_@GDScript_annotation_@tool >` scripts.
384
+ Also the property value is copied when :ref: `Resource.duplicate() <class_Resource_method_duplicate >`
385
+ or :ref: `Node.duplicate() <class_Node_method_duplicate >` is called, unlike non-exported variables.
386
+
387
+ ::
388
+
389
+ var a # Not stored in the file, not displayed in the editor.
390
+ @export_storage var b # Stored in the file, not displayed in the editor.
391
+ @export var c: int # Stored in the file, displayed in the editor.
392
+
371
393
Setting exported variables from a tool script
372
394
---------------------------------------------
373
395
@@ -394,5 +416,5 @@ described in :ref:`doc_accessing_data_or_logic_from_object`.
394
416
.. seealso :: For binding properties using the above methods in C++, see
395
417
:ref: `doc_binding_properties_using_set_get_property_list `.
396
418
397
- .. warning :: The script must operate in the ``tool`` mode so the above methods
419
+ .. warning :: The script must operate in the ``@ tool`` mode so the above methods
398
420
can work from within the editor.
0 commit comments