Skip to main content

AppSceneTreeExt

Trait AppSceneTreeExt 

Source
pub trait AppSceneTreeExt {
    // Required methods
    fn register_scene_tree_component<C>(&mut self) -> &mut Self
       where C: Component + Default;
    fn register_scene_tree_component_with_init<C, F>(
        &mut self,
        init_fn: F,
    ) -> &mut Self
       where C: Component,
             F: Fn(&mut EntityCommands<'_>, &mut GodotNode<'_, '_>) + Send + Sync + 'static;
}
Expand description

Extension trait for App to register scene tree components

Required Methods§

Source

fn register_scene_tree_component<C>(&mut self) -> &mut Self
where C: Component + Default,

Register a component to be added to all scene tree entities with default value

Source

fn register_scene_tree_component_with_init<C, F>( &mut self, init_fn: F, ) -> &mut Self
where C: Component, F: Fn(&mut EntityCommands<'_>, &mut GodotNode<'_, '_>) + Send + Sync + 'static,

Register a component with custom initialization logic that has access to the Godot node

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AppSceneTreeExt for App

Source§

fn register_scene_tree_component<C>(&mut self) -> &mut Self
where C: Component + Default,

Source§

fn register_scene_tree_component_with_init<C, F>( &mut self, init_fn: F, ) -> &mut Self
where C: Component, F: Fn(&mut EntityCommands<'_>, &mut GodotNode<'_, '_>) + Send + Sync + 'static,

Implementors§