Godot-proposals: Duplicating a node should result in either a true Instance or true unique copy, not a mix of both

Created on 18 Dec 2019  路  5Comments  路  Source: godotengine/godot-proposals

Describe the project you are working on:
In all my projects I'm duplicating and instancing nodes all the time.

Describe the problem or limitation you are having in your project:
When I duplicate nodes, they are neither unique (aka independent or disconnected from their original), nor are they completely connected: a pure instance where changing one thing in any one of the duplicates results in the same change happening to all of the duplicates.
instance_or_duplicate

Describe how this feature / enhancement will help you overcome this problem or limitation:
Having either true Instances of nodes or true unique duplicates would prevent confusion, unintentional changes, self inflicted bugs.
Ideally I would like to be able to do something like

  • rightclick on a node in the Scene Panel for the context menu and select "create Duplicate (Ctrl+D)" to create a unique duplicate
  • and "create Instance (Ctrl + I )" (or Ctrl+Shift+D) to create a true Instance of the Node I just created.

If I would want a specific Resource to be shared, by multiple nodes, I would like to Save the resource as a .res for instance, and then load it into any another node (already possible).
This would be intentional driven design for me.

Show a mock up screenshots/video or a flow diagram explaining how your proposal will work:
Imagine either both color changing _and_ shapes changing in the gif above (true instance) or both color _and_ shape changes stay independent from the original (unique duplicate)

Describe implementation detail for your proposal (in code), if possible:
for me not possible

If this enhancement will not be used often, can it be worked around with a few lines of script?:
Would be used a lot because duplication of nodes is a very common thing in Godot.

Is there a reason why this should be core and not an add-on in the asset library?:
It's about existing core functionality

core editor

Most helpful comment

I agree with the naming change. Duplicate doesn't suggest the linked copy. When I duplicate the file on computer it doesn't change because I change original or more importantly even original doesn't change because I edited a copy. Separating instance and duplicate would be clearer

All 5 comments

Setting up resources to be unique across instances is possible by enabling Local To Scene option:

godot-local-to-scene-duplicate

It works for scenes only though. I wish I knew about this feature from the moment I started using Godot!

Resources are shared by default to improve re-usability and performance. Scripts are also resources and they 99% of the time have to be shared. One can take a conscious advantage of this so that changes to a single resource can affect some behavior of existing nodes at run-time so you don't have to go through each node to change a particular property (say friction, see PhysicsMaterial).

I think there's much confusion as to how duplicating works in Godot, for instance see godotengine/godot#33824.

So yeah I think it's necessary to distinguish between shallow/deep/instance duplication across the editor. Adding an additional submenu popup for this could be a step forward:

godot-duplicate-unique

Thank you @Xrayez for sharing your thoughts!
Thanks @Zireael07 for the links!

I totally get why it is good and important to allow resources to be shared.
What I don't get is the fact that this is the default. It's currently is opt-out, but strongly feel it should be opt in.

Or clearly differentiate between instancing (everything shared) and duplication (everything unique).

The shapes resource is just a visual example you can easily miss until many many commits later. I actually have and had much more problems with scripts and animations before I learned never to share scripts and never to save animations.

It should not be like that. Sharing scripts with nodes should not threat to override your work if you did not know about that checkbox or forgot to tick it. Neither should saving animations or changing CollisionShapes be a threat to the work you already created.

I agree with the naming change. Duplicate doesn't suggest the linked copy. When I duplicate the file on computer it doesn't change because I change original or more importantly even original doesn't change because I edited a copy. Separating instance and duplicate would be clearer

@Calinou I believe the topic:core label is also relevant here as they are suggesting that these changes also be applied even when executed from code. It isn't an editor-specific issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arkology picture arkology  路  3Comments

davthedev picture davthedev  路  3Comments

KoBeWi picture KoBeWi  路  3Comments

wijat picture wijat  路  3Comments

PLyczkowski picture PLyczkowski  路  3Comments