gdnative
gdnative copied to clipboard
Add example for exposing Rust types to GDScript, using derive macros and/or wrapper classes
This question is asked pretty frequently, so it's good to have something to point users to.
- Exposing value types through
FromVariant
andToVariant
. - Exposing operations on those types, e.g.
Eq
, through helper methods on a auto-load script. - Exposing opaque types / types with behaviors through wrapper classes.
- Factory auto-load to work around the constructor argument problem.
Partially documented in https://godot-rust.github.io/book/rust-binding.html. The points mentioned above (especially using a wrapper or auto-load script) still need documentation and/or an example.
Autoload singletons now seem to be documented here: https://godot-rust.github.io/book/gdnative/faq/code.html#can-i-implement-static-methods-in-gdnative
Closing as completed.