-
-
Notifications
You must be signed in to change notification settings - Fork 584
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
Changes necessary for hot reload to work #1200
Conversation
Hm, this worked in my testing because my test classes declared their own constructors without any arguments. This is failing the tests because they don't, and just rely on the default constructor being inherited from the parent class. But now that this PR adds a secondary constructor, the default won't be inherited anymore. :-/ I'm not yet sure what a good solution would be... |
ee8180d
to
102867a
Compare
I came up with a "hack" to workaround the problem described in my last comment. Rather than adding a new constructor that can handle recreating instances, it adds the info about any instances being recreated to a global list, and then the usual constructor will check if this instance is meant to be recreated, and if so, do that process instead. Since this is a little ugly, I've wrapped this in a |
fcd114b
to
7fa6875
Compare
Taking this one out of draft because the Godot PR has also come out of draft, but it won't pass tests (and can't be merged) until Godot PR godotengine/godot#80284 is merged |
b78da0e
to
645e607
Compare
Temporarily rebasing on PR #1239 to keep this compatible with the Godot PR. Hopefully, that one will be merged soon-ish and this can go back to being a single commit |
5ed708a
to
2f77bcf
Compare
I have updated the library. Now there is no crash in Also a re-registered singleton still causes:
|
I want to add information about singleton. # work
Engine.get_singleton(&"DebugDraw3D").draw_box(box_pos, Vector3(1, 2, 1), Color(0, 1, 0))
# doesn't work
DebugDraw3D.draw_box(box_pos, Vector3(1, 2, 1), Color(0, 1, 0)) godot.windows.editor.dev.x86_64.mono_cQLdGs8EOE-00.00.17.000-00.00.26.583.mp4Also, if I use my bindings for C#, then after a reload everything also continues to work. This is because I check the validity of the cached instance and try to get it if it is private static GodotObject _instance;
public static GodotObject Instance
{
get
{
if (!GodotObject.IsInstanceValid(_instance))
{
_instance = Engine.GetSingleton("DebugDraw3D");
}
return _instance;
}
} godot.windows.editor.dev.x86_64.mono_ulWApN7KQa-00.00.21.000-00.00.32.683.mp4It turns out that GDScript just doesn't update the singleton cache somewhere. |
@DmitriySalnikov: Thanks to all your testing and reports I've managed to find and fix a whole bunch of bugs!
This should be fixed with the latest versions of both PRs: you should get
Hm, interesting, good find! I haven't had a chance to look into this one yet, but I guess we'd need the Godot PR to signal to GDScript to clear its singleton cache somehow. |
Thanks, I've already checked it out. Now the plugin is removed as if the engine was closed in the usual way without a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, need to wait on upstream merge and nitpicky rename :)
These are the changes necessary to work with Godot PR godotengine/godot#80284