Enum EditorRunBehavior
#[non_exhaustive]pub enum EditorRunBehavior {
ToolClassesOnly,
AllClasses,
}
Expand description
Determines if and how an extension’s code is run in the editor.
By default, Godot 4 runs all virtual lifecycle callbacks (_ready
, _process
, _physics_process
, …)
for extensions. This behavior is different from Godot 3, where extension classes needed to be explicitly
marked as “tool”.
In many cases, users write extension code with the intention to run in games, not inside the editor.
This is why the default behavior in gdext deviates from Godot: lifecycle callbacks are disabled inside the
editor (see ToolClassesOnly
). It is possible to configure this.
See also ExtensionLibrary::editor_run_behavior()
.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ToolClassesOnly
Only runs #[class(tool)]
classes in the editor.
All classes are registered, and calls from GDScript to Rust are possible. However, virtual lifecycle callbacks
(_ready
, _process
, _physics_process
, …) are not run unless the class is annotated with #[class(tool)]
.
AllClasses
Runs the extension with full functionality in editor.
Ignores any #[class(tool)]
annotations.
Trait Implementations§
§impl Clone for EditorRunBehavior
impl Clone for EditorRunBehavior
§fn clone(&self) -> EditorRunBehavior
fn clone(&self) -> EditorRunBehavior
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more