You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# main.gdextendsControl@exportvarsignal_input: SignalInput## (Node: Set to a timer node, Name: "timeout")@onreadyvartimer=$Timerfunc_ready():
awaitsignal_input.node[signal_input.name] ## await timer.timeoutprint("[Method 1] Resource signal, will not appear") ## this should never run
The text was updated successfully, but these errors were encountered:
SwatDoge
changed the title
When using a Node exported through a Resource, you can not listen for its signals.
When using a Node exported through a Resource, you can not listen to its signals.
Oct 4, 2023
I think this is not a bug, but rather an limitation. Exported nodes are serialized as NodePaths, not as objects. In the case of resources, you cannot access an outer node, this makes little sense since several nodes can use the same resource. So I think we should document the limitation, and also add an error/warning to GDScript if a non-Node derived class exports nodes.
I also encountered this limitation, ended up working around it by having the resource's owner pass a reference to the tree for resource to actually get the nodes. The exported values have to be NodePaths like in good old days.
I didn't get yet around to make an issue for it, but if you debug what's actually going on, it seems that your Resource creates just Node.new() instead of getting the actual node - that's why no errors are raised when trying to connect the signal.
Godot version
4.1.1.stable
System information
Godot v4.1.1.stable - Windows 10.0.22621 - Vulkan (Compatibility) - NVIDIA GeForce RTX 3080 Ti (NVIDIA; 31.0.15.3168) - 12th Gen Intel(R) Core(TM) i9-12900K (24 Threads)
Issue description
With the code below, if you select a node and a signal name, it will await the execution of the signal correctly.
If I now move these exports to a Resource class, the code will no longer work:
Steps to reproduce
Minimal reproduction project
source.zip
The text was updated successfully, but these errors were encountered: