-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
must_have_an_init_method
is too strict
#617
Comments
Godot itself expects to construct and destroy all declared classes with the init function while opening editor - for full rationale, you should look into the upstream. You could test declaring If your objects are descendants of However, if you are creating the objects through |
@MatrixDev check out #593, the new API is explained there. Everything you did before is still possible 🙂 |
I strongly recommend against this pattern, unless you actually need default-constructibility. It weakens invariants, introduces "zombie states" and requires Some Rust classes are never directly needed in the editor, but just passed around in GDScript code. It's valid to write |
@Bromeon Yeah, thanks for the clarification. If |
Thanks, now everything work. I should've read updated docs more closely, my bad... Now I also undestand why hot-reloading stopped working for me when I've started populating project with classes (#539). |
Lets just say introduction of
must_have_an_init_method::__type_check
just broke half of my project...I'm not using
#[class(init, ...)]
nor defininginit
in#[godot_api]
because those don't allow me to pass custom arguments. So I just used a simple pattern for most of my objects:Is there any way to construct objects without the need of
Option
now?The text was updated successfully, but these errors were encountered: