system
1
|
|
|
 |
Attention |
Topic was automatically imported from the old Question2Answer platform. |
 |
Asked By |
Landro974 |
I am new to game developing, and I want an object to duplicate itself at an event. I tried with
if event :
self.duplicate()
but it didn’t do anything.
system
2
|
|
|
 |
Reply From: |
stephann |
I’m not sure, but I think you will need to add duplicated object to scene.
var dup = self.duplicate()
self.get_parent().add_child(dup)
1 Like
system
3
|
|
|
 |
Reply From: |
iNeedMentalHelp |
Although I haven’t tried this, I’d do it like this:
var nodeSelf = load("../nameOfTheNodeYoureGonnaduplicate").instance()
get_tree().current_scene.add_child(nodeSelf)
Edit: And do not remove the 2 dots
I don’t know how to help you anymore as I use v3.5.2 since I’d have to rewrite most of the code I already have written
iNeedMentalHelp | 2023-06-25 10:49