gdnative icon indicating copy to clipboard operation
gdnative copied to clipboard

Add example for exposing Rust types to GDScript, using derive macros and/or wrapper classes

Open ghost opened this issue 4 years ago • 1 comments

This question is asked pretty frequently, so it's good to have something to point users to.

  • Exposing value types through FromVariant and ToVariant.
  • 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.

ghost avatar Sep 25 '20 18:09 ghost

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.

Bromeon avatar Aug 01 '21 17:08 Bromeon

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.

chitoyuu avatar Jan 29 '23 07:01 chitoyuu