HI!
I get the following error:
Loot.gd:6 @ _ready(): Signal ‘body_entered’ is already connected to given callable ‘RigidBody2D::_on_body_entered’ in that object.
Loot.gd:
extends Node2D
@export var item:Item
func _ready():
var instance = item.scene.instantiate() #<- this is line 6
call_deferred("add_child", instance)
item.scene is a PackedScene.
This PackedScene is inherited from a Base scene that is also used to create a few more PackedScenes.
All these PackedScenes are instantiated via the same code above (they have the same script attached).
There is a ‘body_entered’ signal connected inside the “Base scene” node, that all these PackedScenes are inherited from.
“Base scene” is just a RigidBody2D with Collision shape, Sprite2d and a signal connected from itself into its script:
func _on_body_entered(body):
pass
When I check Remote, godot creates all the instantiated nodes, but fails to attach the scripts with the signal to all except one (i.e. it does not copy the script from the Base scene node it inherits from).
The idea was that each instance will get their unique nodes and unique signal connected to them, but it does not seem to be like that.
Can anyone give me a hint, what am I doing wrong?
Thank you very much!