The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

–1 vote

If you know, cheeeers!

in Engine by (326 points)

Do you want an actual copy where the original still exists, or just to move a node from one scene to a different scene?

Yes, an actual copy, keepin the original in his scene.

2 Answers

0 votes

you can try to create a global script wich is always accesible and create a variable and store it the node there and then add a node that you get from there.
I think there should be a better way but this should work at least.

by (16 points)

Ok, seems that actually it would be faster to create the node once again. For me at least, and my knowledge of scripts and autoloads...


+4 votes

Can you give this a try?

func clone(node: Node) -> Node:
    var copy = node.duplicate()
    # see
    var properties: Array = node.get_property_list()

    var script_properties: Array = []

    for prop in properties:
        # see[email protected]#enum-globalscope-propertyusageflags
            # basically here we are getting any of the user-defined script variables that exist, since those apparently don't
            # get copied via `duplicate()`

    for prop in script_properties:
        copy.set(, node[])

    return copy

I would suggest putting that in an autoloaded script ( or something) so that you can call it from anywhere like:

var friend_node = Utils.clone(lonely_node)


Apparently this is not what you were asking. If you just want to be able to duplicate a node in the editor, save the node you want to duplicate as its own scene. Then go to the scene you want it to be in, right-click the root node, select "Instance Child Scene", and select the node/scene you want.

by (1,663 points)
edited by

Erh... Where will the copy go into my other scene?

And you know, i'd like to clone it and use it, editin it as another node in my other scene, not havin it appear when loadin the game eh. Just like a duplicate, but in another scene.

Updated the answer

Thxs, but that's still a bit complicated, though i understand it. I'd prefer avoidin to create and instance new scenes just for duplicated nodes.

Well that is how it works in Godot

Just wanna share if you want to delete the scene after duplicating the node:
after clicking "Instance Child Scene", you can right click the instance --> "make local" on both instance, then you can delete the scene

True, that simple. :)

This is exactly what I needed.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.