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
{{ message }}
Repository navigation
Calling connect within extension class ctor causes set_instance_bindings error #1312
Can you try using NOTIFICATION_POSTINITIALIZE instead as a workaround?
No, because unfortunately NOTIFICATION_POSTINITIALIZE is not fired like it is in GDScript, see #1269 ; however, right now I am using NOTIFICATION_ENTER_TREE or NOTIFICATION_READY at the moment.
Can you try using NOTIFICATION_POSTINITIALIZE instead as a workaround?
No, because unfortunately NOTIFICATION_POSTINITIALIZE is not fired like it is in GDScript, see #1269 ; however, right now I am using NOTIFICATION_ENTER_TREE or NOTIFICATION_READY at the moment.
PR #1321 was recently merged to fix NOTIFICATION_POSTINITIALIZE. Perhaps that is now another way to work around this issue?
Thanks, based on the feedback, I am going to close this as it seems the agreed approach is to use a later phase during object construction than the constructor to perform signal connections.
Activity
dsnopek commentedon Nov 20, 2023
Thanks!
I think this is a variation on issue #1039
Basically, at present, you can't pass
thisinto any Godot APIs during the constructor, because the object isn't finished being setup at that point.AThousandShips commentedon Nov 20, 2023
Can you try using
NOTIFICATION_POSTINITIALIZEinstead as a workaround?Naros commentedon Nov 22, 2023
No, because unfortunately
NOTIFICATION_POSTINITIALIZEis not fired like it is in GDScript, see #1269 ; however, right now I am usingNOTIFICATION_ENTER_TREEorNOTIFICATION_READYat the moment.bearman92 commentedon Nov 22, 2023
I found a workaround that works for me
I added _init() method to Wrapped
And call at end of the Wrapped::_postinitialize
And I just use _init instead of constructors.
AThousandShips commentedon Nov 22, 2023
Generally many signals are best to connect on entering the tree, partially due to threading, see:
dsnopek commentedon Dec 6, 2023
PR #1321 was recently merged to fix
NOTIFICATION_POSTINITIALIZE. Perhaps that is now another way to work around this issue?Naros commentedon Jan 12, 2024
Thanks, based on the feedback, I am going to close this as it seems the agreed approach is to use a later phase during object construction than the constructor to perform signal connections.