Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin:
    Send
    + Sync
    + 'static {
    // Required method
    fn build(&self, app: &mut App);

    // Provided methods
    fn name(&self) -> &'static str { ... }
    fn dependencies(&self) -> Vec<TypeId> { ... }
}
Expand description

A modular unit of app configuration.

Plugins add systems, resources, and other configuration to an App. They enable reusable, composable game engine features.

§Example

use goud_engine::ecs::app::{App, Plugin};

struct PhysicsPlugin;

impl Plugin for PhysicsPlugin {
    fn build(&self, app: &mut App) {
        // Add physics systems, resources, etc.
    }
}

Required Methods§

Source

fn build(&self, app: &mut App)

Configures the app with this plugin’s systems and resources.

Provided Methods§

Source

fn name(&self) -> &'static str

Returns the name of this plugin for debugging.

Source

fn dependencies(&self) -> Vec<TypeId>

Returns the TypeIds of plugins this plugin depends on.

Dependencies must be added before this plugin. The default implementation returns an empty list (no dependencies).

Implementors§