- Edited
Working through the Signals Tutorial, and it's not clear what's really happening.
It looks like there is a "top-level" Scene, which has a child Sprite-Scene - and the tutorial is adding a Button to the top-level Scene, then connecting it to a script, that is attached to a Sprite, that is inside the child Sprite-Scene. IOW, not modifying the Sprite-Scene itself. But all I get is "cannot connect signal, target method not found."
I could add a button directly into the Sprite-scene and connect it, no problem. And it looks like if I attached a script to the 2D Node at the top of the Sprite-scene, that would also give the top-level Button, something to connect to.
But if I understand this right, the top-level Button is connecting to existing Sprite's script (which does have an "_on_Button_pressed()" func. So it's treating the Sprite-scene as a single Component, that doesn't need to be modified internally, to work.
I just can't get it to work. Any thoughts on what I'm missing?
Attach Script seems to imply that, as long as the script exists, the Button can find it.
I also notice, that the tutorial, shows the word "Sprite" in the left-panel - but even though I renamed my child-scene SpriteScene, it displays as "Node2D" in the top-level Scene. I thought I followed the tutorial correctly...
One more difference:
In the tutorial, it shows a "script-icon", whereas mine doesn't. Does this mean there should be a script attached to the top node? Or is there something needed, to "expose" the Sprite script - maybe make it Public, or something?