Skip to content

sprite spawned after start is not displayed #996

@mockersf

Description

@mockersf

Bevy version

git 7699f8b6db0af6ca62fcd033e05df4f6c71ecb23 (current master at the time of this issue) - #987

Operating system & version

macOS 10.15.7

What you did

Spawn a sprite during game when none has been displayed at start

use bevy::prelude::*;

fn main() {
    App::build()
        .add_plugins(DefaultPlugins)
        .add_startup_system(setup)
        .add_system(display)
        .run();
}

fn setup(commands: &mut Commands) {
    commands.spawn(Camera2dBundle::default());
}

fn display(
    commands: &mut Commands,
    mut first: Local<bool>,
    asset_server: Res<AssetServer>,
    mut materials: ResMut<Assets<ColorMaterial>>,
) {
    if !*first {
        let texture_handle = asset_server.load("branding/icon.png");
        info!(
            "displaying sprite: {:?}",
            commands
                .spawn(SpriteBundle {
                    material: materials.add(texture_handle.into()),
                    ..Default::default()
                })
                .current_entity()
        );
        *first = true;
    }
}

What you expected to happen

The sprite should have been displayed

What actually happened

The sprite wasn't displayed

Additional information

It was working with previous bevy commit

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions