Skip to content

Warning about duplicating nodes

HungryProton edited this page Dec 31, 2020 · 3 revisions

Be careful when you duplicate a node in Godot

In Godot, some nodes contains smaller pieces of data called Resources.

Imagine a node, owning a resource like this :

base_node_a

If you want to duplicate this node A, you may assume to end up in this scenario

duplicate_expectations

BUT THIS IS NOT THE CASE

By default, you will end up in this situation instead:

duplicate_reality

And it may or may not be what you wanted. In Scatter, the Curve is a resource, the Multimesh (inside the multimesh instance) is a resource, and unless you want to share these between multiple nodes (which works perfectly fine too if you need it), then you need to make sure they are duplicated as well.

By default, Scatter takes care of duplicating everything for you

But it relies on a workaround because the duplication event is not exposed, so in rare situations the resources may end up being shared.

Two ways to ensure resources are duplicated:

Either click on the white arrow to reset the parameter or click the down arrow and select a new resource type in the menu. This will create a new blank resource but the resources inner parameters will be reset as well.

reset_resource

If you have many resources though, the fastest way is to click the screwdriver icon on the top right and select Make sub-resources unique

make_sub_unique

And now you should be in this situation

duplicate_expectations