Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C#: Script methods bound to tree_exited / _ExitTree() can't be found. #82279

Closed
juse4pro opened this issue Sep 25, 2023 · 3 comments · Fixed by #83670 · May be fixed by #84013
Closed

C#: Script methods bound to tree_exited / _ExitTree() can't be found. #82279

juse4pro opened this issue Sep 25, 2023 · 3 comments · Fixed by #83670 · May be fixed by #84013

Comments

@juse4pro
Copy link

Godot version

v4.2.dev5.mono.official [e3e2528]

System information

Windows 11

Issue description

After I upgraded my Godot version from 4.2dev3 to 4.2dev5 I encountered the issue that the tree_exited signal fires on nodes that have my custom C# script attached but it somehow already "forgot" that the Node actually had my script attached. So I get the error emit_signalp: Error calling from signal 'tree_exited' to callable: 'Node2D::_on_tree_exited': Method not found. <C++ Source> core/object/object.cpp:1125 @ emit_signalp()

The same problem leads to the fact that my public override void _ExitTree() method in my script does not even run at all.

Steps to reproduce

  • Create a node with a C# script attached to it that implements either _ExitTree() or where the scene is connected to the tree_exited signal (calling a method on the same scene)
  • Put debug prints into the signal-connected method or the _ExitTree() one
  • Create a wrapper scene which contains the first scene
  • Let the node of the first scene get removed by calling QueueFree() when clicking a button or pressing any key
  • Get errors (in signal case) or no printing at all (in _ExitTree() case)

Minimal reproduction project

Start the project and click the button. Notice that we don't get the log message from _ExitTree() and also an error from the tree_exited signal connection.
tree-exit-bug.zip

@juse4pro juse4pro changed the title C#: Script methods bound to tree_exited / can't be found. C#: Script methods bound to tree_exited / _ExitTree() can't be found. Sep 25, 2023
@AlexanderLangguth
Copy link

I tested a bit and can confirm that it is working in 4.2 dev3 but stops working in 4.2 dev4.

@zaevi
Copy link
Contributor

zaevi commented Oct 13, 2023

Still confirmed in 4.2 beta1

@magian1127
Copy link
Contributor

It has been confirmed that the issue is caused by the modification of Object::notification() in #78634

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment