Topic was automatically imported from the old Question2Answer platform.
Asked By
Suleymanov
I have Main scene, let’s call it Scene A. Then I have another scene, let’s call it Scene B. I instanced B in A. B (UI scene) has buttons. But when I want to connect the pressed signal to the A script, it’s not there. What’s the correct method to do it?
You want to take the scene A and write the function you want to connect too
func _sceneB_connection:
Pass
then when you instance the Scene B you want to connect that over to scene A within scene A
var bScene = sceneB.instance()
add_child(bScene)
bScene.connect("SIGNAL NAME", self, "_sceneB_connection" )
If you have any other questions, don’t be afraid to ask more questions!
FYI the signal name for button pressed is “pressed”
B script:
func _on_button_pressed():
#how to transfer signal to the A script? (if it were in A script, I would directly write $object.rotate as "object" is in A script)