#Does order matter when adding plugins?

1 messages · Page 1 of 1 (latest)

storm tulip
#

I want to use this pattern from the bevy cheatbook:
https://bevy-cheatbook.github.io/features/log.html#different-settings-for-debug-and-release-builds

use bevy::log::LogPlugin;

// this code is compiled only if debug assertions are enabled (debug mode)
#[cfg(debug_assertions)]
app.add_plugins(DefaultPlugins.set(LogPlugin {
    level: bevy::log::Level::DEBUG,
    filter: "debug,wgpu_core=warn,wgpu_hal=warn,mygame=debug".into(),
}));

// this code is compiled only if debug assertions are disabled (release mode)
#[cfg(not(debug_assertions))]
app.add_plugins(DefaultPlugins.set(LogPlugin {
    level: bevy::log::Level::INFO,
    filter: "info,wgpu_core=warn,wgpu_hal=warn".into(),
}));

It seems easier to add this after adding all of the other plugins, but will that break things? Do the DefaultPlugins need to be added first?

frail trench
#

Order does matter and you do usually want to add default plugins first as other plugins can depend on things added in default plugins