pub trait Singleton: GodotClass {
// Required method
fn singleton() -> Gd<Self>;
}Expand description
Trait for singleton classes in Godot.
There is only one instance of each singleton class in the engine, accessible through singleton().
Required Methods§
Sourcefn singleton() -> Gd<Self>
fn singleton() -> Gd<Self>
Returns the singleton instance.
§Panics
If called during global init/deinit of godot-rust. Most singletons are only available after the first frame has run.
See also ExtensionLibrary.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.