Open-Source Wikis

/

Bevy

/

Packages

/

bevy_internal

bevyengine/bevy

bevy_internal

A meta-crate that exists for one reason: it lets the public bevy crate be loaded as a cdylib for fast compiles via bevy_dylib. All of Bevy's subordinate crates are re-exported through this crate, and the canonical DefaultPlugins and MinimalPlugins plugin groups are defined here.

Purpose

bevy_internal is the central composer of the workspace. It:

  • Re-exports each bevy_* crate as a public module (bevy::ecs, bevy::render, …) behind feature flags.
  • Defines DefaultPlugins (the "give me everything" group) and MinimalPlugins (the headless equivalent).
  • Provides the unified bevy::prelude that pulls each subcrate's prelude into one namespace.

This crate is not meant to be depended on directly. Use bevy instead.

Directory layout

crates/bevy_internal/src/
├── default_plugins.rs   # DefaultPlugins, MinimalPlugins
├── prelude.rs           # The merged top-level prelude
└── lib.rs               # Public re-exports per feature

Key abstractions

Symbol File Description
DefaultPlugins crates/bevy_internal/src/default_plugins.rs The PluginGroup used by most user apps.
MinimalPlugins crates/bevy_internal/src/default_plugins.rs Headless group: task pool, time, frame count, schedule runner.
prelude crates/bevy_internal/src/prelude.rs Merged prelude — re-exports each crate's prelude.

How it works

default_plugins.rs uses the plugin_group! macro from bevy_app. Each line in the macro adds a plugin under a cfg. The result is a PluginGroup whose membership depends on enabled cargo features:

plugin_group! {
    pub struct DefaultPlugins {
        bevy_app:::PanicHandlerPlugin,
        #[cfg(feature = "bevy_log")]
        bevy_log:::LogPlugin,
        bevy_app:::TaskPoolPlugin,
        bevy_diagnostic:::FrameCountPlugin,
        bevy_time:::TimePlugin,
        bevy_transform:::TransformPlugin,
        // …
    }
}

The order matches initialization order — each plugin runs Plugin::build against the same App, so later plugins see resources/types added by earlier ones.

Integration points

  • Depends on: All bevy_* crates.
  • Depended on by: The bevy umbrella crate (and bevy_dylib).

Entry points for modification

  • Adding a new subcrate to DefaultPlugins: add the cfg line in default_plugins.rs and re-export the crate from lib.rs.
  • Adding to the prelude: edit prelude.rs. The convention is to re-export each subcrate's prelude wholesale.
  • Changing the default feature mix: edit Cargo.toml of the top-level bevy crate (one level up, in the workspace root). bevy_internal's feature flags are largely a 1:1 mirror.

See also

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

bevy_internal – Bevy wiki | Factory