Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visibility in Draw components doesn't work properly, I suppose #187

Closed
jayong93 opened this issue Aug 14, 2020 · 5 comments
Closed

Visibility in Draw components doesn't work properly, I suppose #187

jayong93 opened this issue Aug 14, 2020 · 5 comments
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior

Comments

@jayong93
Copy link

jayong93 commented Aug 14, 2020

First of all, thanks for the great game engine!

I have used it to make my prototype game. In the game, I wanted to hide some object(entity) in a particular condition, so I changed the is_visible value in the Draw component of the entity.

But when I set the is_visible value to false, the frame buffer suddenly wasn't refreshed at all. The window kept showing me the last frame just before I set the value to false. And I set the value to true again, then whole world goes normally.

Is this intended or just a bug? If it is a bug, would you fix it or let me know where to start fixing?

@karroffel karroffel added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen labels Aug 14, 2020
@karroffel
Copy link
Contributor

(I assigned the bug label because it sounds like a bug to me, but I am not fully sure myself 😅 )

@cart
Copy link
Member

cart commented Aug 14, 2020

Yeah this certainly sounds like a bug. Individual entity visibility shouldn't determine whether or not we clear the framebuffer. A minimal example that reproduces the error would be helpful here.

@jayong93
Copy link
Author

jayong93 commented Aug 15, 2020

@cart
I added some code to the bevy's breakout example to reproduce the bug:
https://gist.github.com/jayong93/6d2082442c8f7cfe5a4c89b532f98940

What I did is adding this system to breakout.rs to hide a ball on mouse click:
(Nevermind about the function name. It's from my prototype game 😄)

fn speed_circle_place_system(
    mut input_reader: ResMut<EventReader<MouseButtonInput>>,
    button_input: Res<Events<MouseButtonInput>>,
    mut query: Query<(&Ball, &mut Draw)>,
) {
    match input_reader.latest(&button_input) {
        Some(MouseButtonInput {
            button: MouseButton::Left,
            state: ElementState::Pressed,
        }) => {
            for (_, mut draw) in &mut query.iter() {
                draw.is_visible = !draw.is_visible;
            }
        }
        _ => {}
    }
}

If you click left mouse button, the ball would disappear. But also the paddle would stop moving even if you move it by pressing left/right arrow key.

I checked this bug on Windows 10 + rust 1.45.2 and I'm not sure that it is reproducible on other OSs.

@BorisBoutillier
Copy link
Contributor

Issue reproduced on Linux with @jayong93 code, with rustc 1.47.0-nightly (6c8927b0c 2020-07-26) and bevy at 6228e8a

@cart
Copy link
Member

cart commented Aug 20, 2020

Resolved by #230

BimDav pushed a commit to BimDav/bevy that referenced this issue Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

No branches or pull requests

4 participants