Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notes for Node exports #10396

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tutorials/scripting/gdscript/gdscript_exports.rst
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,13 @@ without having to use NodePaths:
# Custom classes declared with `class_name` can also be used.
@export var some_button: BaseButton

.. note::

Node exporting is only supported in Node-derived classes. When a Node is
saved to a PackedScene, using ``Node`` or ``Array[Node]`` will store a
reference to a Node in the scene, but using ``Array`` or ``Dictionary``
to store Nodes will cause a copy of each Node to be created.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the latter is intentional behavior, it's more of an oversight. Although node export is implemented essentially as a hack.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's how it works though and its something people can get tripped up on. Letting people know this is how it works is probably better than ignoring it, at least until the behaviour is changed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We try not to document bugs or behavior that might change without clearly indicating this. Otherwise, users might rely on the behavior and use the documentation as an argument in discussions.


Exporting NodePaths like in Godot 3.x is still possible, in case you need it:

::
Expand Down