![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | JeremiasDev |
Hello, I have a problem when I say in my script
var object = preload ("res: //scene/object.tscn") .instance ()
and the object is duplicated.
then everything loads perfectly, but my scene contains a signal, to be precise a button signal.
If I press the button then the output shows an error:
E 0: 00: 04.882 emit_signal: Error calling method from signal 'pressed': 'Node2D (tree.gd) :: _ on_Button_pressed ()': Method not found ..
<C ++ source code> core / object.cpp: 1260 @ emit_signal ()
this cannot then be carried out.
Does anyone know what I mean and what I can do?
Thanks in advance
Does the method exist on the object you are running .instance()
if not, you may have to make the signal connection in code. For example, if you have a main scene instancing enemies and those enemies have signals that need to call the main scene’s methods, you can connect the signals to the main scene when it creates the enemies. Check out connecting signals in code.
Tom Mertz | 2020-12-13 03:15