-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Godot exception while using SetScript #19406
Comments
CC @neikeq |
More observations: If I try to store the generated scene (with added script) to a variable and switch to it it later on, it doesn't work:
In the case of the stored scene, the targetScene will always be Null . Same function works perfectly in other cases. If I try to get NativeInstance or even inspect the scene in VSCode debug console, I get the stacktrace (see below): Plus, it seems that the game exits abruptly after some time with a similar stacktrace.
|
And another observation - this behavior seems to corrupt .mono folder. If I open Godot itself after the exception (I usually build and run with msbuild via command line), it will close almost instantly. To fix it, I need to delete .mono folder, reopen Godot and run the script from there so that it rebuilds the required files. |
For easier testing, could you share a minimal example project to reproduce the bug? |
example.zip I don't see the output of exception in Godot console, although Godot does close abruptly. I generally see the output by running
and then watching the terminal |
@xfactor2000 Consider moving your log outputs into GitHub Gists. Also, I can't reproduce with the example project because |
I think Weakref() was moved to Godot.Object. |
Can anyone give me an update of the state of this issue on latest master? Specially if the backtrace at the end is still reproducible. Regarding |
Doesn't seem to crash anymore in 3.1 beta 6, after changing |
Godot version:
Godot Mono 3.0.2 official
OS/device including version:
Manjaro Linux 17.1.10 Hakoila
Issue description:
I'm getting weird errors while dynamically setting script for a node. Right now, I try to generate a scene randomly. I have a class with a logic which eventually boils down to this:
This configuration gives me this weird Godot error:
However, if I move the first two lines to the end of the function, everything works:
I thought it was connected to the fact that I shouldn't set script while the class instance was being busy placing objects on the scene, so I tried
CallDeferred()
but got the same error.Please note that the
scene
object is not in the SceneTree while running this, the scene is only added to the tree once the decorations are set up and the SetScript is called.Also, I started getting this weird stacktrace while closing Godot window (definitely related to SetScript/WeakRef, because if I close the window before this line is called then no stacktrace is shown):
The text was updated successfully, but these errors were encountered: