Custom resources
Custom Resource
s are exposed to the end user to use within their development. Resource
s can store data that is easily edited from within
the editor GUI. For example, you can create a custom AudioStream
type that handles a new and interesting audio file type.
Registering a Resource
This workflow is similar to the Hello World example:
The above resource does not export any variables. While not all resources require exported variables, most do.
To execute code within the Godot Editor (e.g., overriding set_property
to run custom logic when editing Inspector properties),
you should annotate the class with #[class(tool)]
.
It is important that similar to defining custom resources in GDScript, marking this class as a "tool class" is required to be usable within the editor.
The systems for registering functions, properties, and more are described in detail in the Registering Rust symbols section.