Skip to content

Disabling default features causes app with DefaultPlugins to exit #8110

@beeryt

Description

@beeryt

Bevy version

0.10.0

What you did

I wrote a simple little reproducible program called eager-hello:

use bevy::prelude::*;
fn main() {
  App::new()
    .add_plugins(DefaultPlugins)
    .add_system(|| println!("hello"))
    .run();

With the following Cargo.toml, the program is not as eager as I had hoped:

[dependencies.bevy]
version = "0.10.0"
default-features = false

What went wrong

The expected output would be:

hello
hello
hello
...

Unfortunately I only get:

hello

Additional information

If I remove the default-features = false from Cargo.toml the program works as expected.
However, I want a simple program with as few dependencies as possible.

I've tried disabling the window exit condition:

use bevy::prelude::*;
fn main() {
    App::new()
        .add_plugins(DefaultPlugins.set(WindowPlugin {
            primary_window: None,
            exit_condition: bevy::window::ExitCondition::DontExit,
            close_when_requested: false,
        }))
        .add_system(|| println!("hello"))
        .run();
}

I've tried disabling the window plugin:

use bevy::prelude::*;
fn main() {
  App::new()
    .add_plugins(DefaultPlugins.build().disable::<WindowPlugin>())
    .add_system(|| println!("hello"))
    .run();

I tried to get further insight by looking at the logging, but nothing seems obvious for why the app exits after one update cycle.
Here is the log from where the WindowPlugin was disabled:

2023-03-16T22:34:41.104978Z DEBUG bevy_app::plugin_group: added plugin: bevy_core::TaskPoolPlugin
2023-03-16T22:34:41.105039Z DEBUG bevy_app::app: added plugin: bevy_core::TaskPoolPlugin
2023-03-16T22:34:41.105230Z TRACE bevy_core::task_pool_options: Assigning 8 cores to default task pools
2023-03-16T22:34:41.105256Z TRACE bevy_core::task_pool_options: IO Threads: 2
2023-03-16T22:34:41.105403Z TRACE bevy_core::task_pool_options: Async Compute Threads: 2
2023-03-16T22:34:41.105526Z TRACE bevy_core::task_pool_options: Compute Threads: 4
2023-03-16T22:34:41.105817Z DEBUG bevy_app::plugin_group: added plugin: bevy_core::TypeRegistrationPlugin
2023-03-16T22:34:41.105847Z DEBUG bevy_app::app: added plugin: bevy_core::TypeRegistrationPlugin
2023-03-16T22:34:41.107118Z DEBUG bevy_app::plugin_group: added plugin: bevy_core::FrameCountPlugin
2023-03-16T22:34:41.107157Z DEBUG bevy_app::app: added plugin: bevy_core::FrameCountPlugin
2023-03-16T22:34:41.107285Z DEBUG bevy_app::plugin_group: added plugin: bevy_time::TimePlugin
2023-03-16T22:34:41.107304Z DEBUG bevy_app::app: added plugin: bevy_time::TimePlugin
2023-03-16T22:34:41.107570Z DEBUG bevy_app::plugin_group: added plugin: bevy_transform::TransformPlugin
2023-03-16T22:34:41.107593Z DEBUG bevy_app::app: added plugin: bevy_transform::TransformPlugin
2023-03-16T22:34:41.107762Z DEBUG bevy_app::app: added plugin: bevy_hierarchy::valid_parent_check_plugin::ValidParentCheckPlugin<bevy_transform::components::global_transform::GlobalTransform>
2023-03-16T22:34:41.108071Z DEBUG bevy_app::plugin_group: added plugin: bevy_hierarchy::HierarchyPlugin
2023-03-16T22:34:41.108096Z DEBUG bevy_app::app: added plugin: bevy_hierarchy::HierarchyPlugin
2023-03-16T22:34:41.108325Z DEBUG bevy_app::plugin_group: added plugin: bevy_diagnostic::DiagnosticsPlugin
2023-03-16T22:34:41.108348Z DEBUG bevy_app::app: added plugin: bevy_diagnostic::DiagnosticsPlugin
2023-03-16T22:34:41.108437Z DEBUG bevy_app::plugin_group: added plugin: bevy_input::InputPlugin
2023-03-16T22:34:41.108464Z DEBUG bevy_app::app: added plugin: bevy_input::InputPlugin
2023-03-16T22:34:41.109808Z DEBUG bevy_app::plugin_group: added plugin: bevy_a11y::AccessibilityPlugin
2023-03-16T22:34:41.109839Z DEBUG bevy_app::app: added plugin: bevy_a11y::AccessibilityPlugin
2023-03-16T22:34:41.131299Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 20.04 Ubuntu", kernel: "5.4.0-139-generic", cpu: "Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz", core_count: "4", memory: "15.5 GiB" }
hello

I even tried disabling plugins one-by-one, but no matter what I tried, I still couldn't get the app to continue:

use bevy::{
    a11y::AccessibilityPlugin, diagnostic::DiagnosticsPlugin, input::InputPlugin, prelude::*,
    time::TimePlugin,
};
fn main() {
    App::new()
        .add_plugins(
            DefaultPlugins
                .build()
                .disable::<WindowPlugin>()
                .disable::<InputPlugin>()
                .disable::<DiagnosticsPlugin>()
                .disable::<FrameCountPlugin>()
                .disable::<AccessibilityPlugin>()
                .disable::<TransformPlugin>()
                .disable::<HierarchyPlugin>()
                .disable::<TypeRegistrationPlugin>()
                .disable::<TimePlugin>()
                .disable::<TaskPoolPlugin>(),
        )
        .add_system(|| println!("hello"))
        .run();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-AppBevy apps and pluginsC-BugAn unexpected or incorrect behaviorP-CrashA sudden unexpected crash

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions