#Signals from PackedScenes erroring.

6 messages · Page 1 of 1 (latest)

glad mortar
#

@export var experience_manager: Node
@export var skill_upgrade_scene1: PackedScene
@export var skill_upgrade_scene2: PackedScene

experience_manager works just fine, but the PackedScenes are throwing an error. Here's what this script does:


func _ready():
    experience_manager.level_up.connect(on_level_up)
    skill_upgrade_scene1.level_up.connect(on_level_up)
    skill_upgrade_scene2.level_up.connect(on_level_up)

And then, all 3 of those exports have this:


signal level_up(new_level: int)

level_up.emit(global.game_data["level"])

The error is seen in the image. But, why? Can you not do this with a PackedScene?

quartz lily
#

yeah, PackedScenes are resources, so you could use the .instantiate() method to create an actual Node, then add it do the scene tree with an add_child call. lmk if that works!

glad mortar
quartz lily
#

if the nodes already exist, then what's the issue?

glad mortar
#

Sometimes just need someone to say "aren't you forgetting something?" to be like "oh yeah!". Thank you.