Giter VIP home page Giter VIP logo

Comments (9)

iiYese avatar iiYese commented on June 1, 2024 1

Does this occur on 0.13?

Nope.

from bevy.

IceSentry avatar IceSentry commented on June 1, 2024 1

I'm currently running a bisect to figure out which commit introduced this bug

from bevy.

alice-i-cecile avatar alice-i-cecile commented on June 1, 2024

Does this occur on 0.13?

from bevy.

alice-i-cecile avatar alice-i-cecile commented on June 1, 2024

This was likely introduced in #10973 by @Aceeri: I would appreciate a before/after test.

from bevy.

iiYese avatar iiYese commented on June 1, 2024

Video of behavior on f91fd32 Screencast_20240515_195205.webm

from bevy.

iiYese avatar iiYese commented on June 1, 2024

Additional behavior of bug: After despawning the entity, resizing or fullscreening the window causes whatever state is invalid to be updated making the gizmo no longer be drawn.

Video: Screencast_20240515_195748.webm

from bevy.

IceSentry avatar IceSentry commented on June 1, 2024

I just tested it with the #10973 commit and it works correctly. So it's something else. I'll run a git bisect

from bevy.

iiYese avatar iiYese commented on June 1, 2024

Modifying the code to this:

use bevy::prelude::*;

#[derive(Component)]
struct Point(Vec2);

fn setup(mut cmds: Commands) {
    cmds.spawn(Camera2dBundle::default());
    cmds.spawn(Point(Vec2::new(0.0, 150.0)));
    cmds.spawn(Point(Vec2::new(100.0, 150.0)));
    cmds.spawn(Point(Vec2::new(200.0, 150.0)));
    cmds.spawn(Point(Vec2::new(300.0, 150.0)));
}

fn draw(mut gizmos: Gizmos, tree: Query<&Point>) {
    for Point(pos) in tree.iter() {
        gizmos.circle_2d(*pos, 40., Color::WHITE);
    }
}

fn despawn(
    mut cmds: Commands,
    points: Query<Entity, With<Point>>,
    mouse_buttons: Res<ButtonInput<MouseButton>>,
) {
    if mouse_buttons.just_pressed(MouseButton::Left) {
        for entity in points.iter().take(1) {
            cmds.entity(entity).despawn();
            println!("despawned");
        }
    }
}

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .add_systems(Update, (draw, despawn).chain())
        .run();
}

Reveals that this happens when you go from exactly 1 gizmo being drawn -> 0 gizmos being drawn.
Edit: Wasn't quite correct. Removing the .take(1) shows that it's actually when you go from any N gizmos being drawn -> exactly 0 gizmos being drawn where 0 < N.

Video: Screencast_20240515_203309.webm

from bevy.

IceSentry avatar IceSentry commented on June 1, 2024

Seems like #12982 is causing the issue. I'm investigating, I'm really not sure how that PR could affect gizmos

from bevy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.