Godot Version
4.6.1
Question
I’ve coded in an item that when interacted with, clones itself. The cloning works perfectly fine, but the clones need to send a signal to the parent. Since the clones are, well, clones, the signal they emit isn’t connected to the parent. I’ve searched around on the forums and most said to make the signal the clones emit connect to their parent via connect(), but for some reason it’s not working? I can tell from using print() that the clones ARE getting the “picked_up” function working, so I believe it’s the signal that the problem here.
The code for the item that is picked up and cloned:
extends Node3D
signal bronzecamerapickedup
func ready():
self.bronzecamerapickedup.connect(get_parent)
func picked_up():
Global.bronzecamera += 1
bronzecamerapickedup.emit()
The code for the item “manager” who the item is the child of:
extends Node
func ready():
pass
func _on_bronzecamera_bronzecamerapickedup():
for i in 10:
var bronzecamerainstance := preload("res://bronzecamera.tscn").instantiate()
bronzecamerainstance.position = Vector3(randf_range(1,2),randf_range(1,2),randf_range(1,2))
add_child(bronzecamerainstance)