-
-
Notifications
You must be signed in to change notification settings - Fork 189
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
Classes without init
break hot reloading
#539
Comments
This explains half of the problems I was having. |
I think absence of a constructor should be explicit. It's the exceptional case, and it's very easy to forget My current idea: #[derive(GodotClass)]
struct MyClass { ... } should still be allowed even with a missing #[godot_api]
impl MyClass {
fn init(base: Base<RefCounted>) -> Self { ... }
} This can be statically enforced: Classes that are deliberately not default-constructible could be annotated with |
Same issue here. but hot reloading is not working all the time even with init for me... |
Same here too. |
Adding |
It seems like a single class that is declared as something like:
-- that is, no
#[class(init)]
and no manual override offn init()
-- is enough to break hot reloading.The Godot error message is not helpful:
There are several measures we can take:
no_init
could work?)init
method are registered properly in GDExtension, meaning they are without a default constructor but otherwise functional.recreate_fn
is needed.reloadable=true
at startup)Long-term, we could probably expose something like a
reinit()
constructor that is invoked on hot reloads, and by default callsinit
. But before working on more features, I'd like to get the base robust.The text was updated successfully, but these errors were encountered: