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

Alien Cake Addict panics in spooky way when cake is spawned on player #1707

Closed
rparrett opened this issue Mar 20, 2021 · 2 comments
Closed
Labels
C-Bug An unexpected or incorrect behavior C-Examples An addition or correction to our examples
Milestone

Comments

@rparrett
Copy link
Contributor

Bevy version

b6be8a5

Operating system & version

macOS

What you did

I played a lot of alien cake addict, but here's a shortcut:

    game.bonus.i = game.player.i; //rand::thread_rng().gen_range(0..BOARD_SIZE_I);
    game.bonus.j = game.player.j; //rand::thread_rng().gen_range(0..BOARD_SIZE_J);

What actually happened

thread 'main' panicked at 'Entity does not exist', /Users/robparrett/src/bevy-fork/crates/bevy_ecs/src/world/mod.rs:214:37
stack backtrace:
   0: rust_begin_unwind
             at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:92:14
   2: core::option::expect_failed
             at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/option.rs:1260:5
   3: core::option::Option<T>::expect
             at /Users/robparrett/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:349:21
   4: bevy_ecs::world::World::entity_mut
             at ./crates/bevy_ecs/src/world/mod.rs:214:9
   5: <bevy_ecs::system::commands::Insert<T> as bevy_ecs::system::commands::Command>::write
             at ./crates/bevy_ecs/src/system/commands.rs:322:9
   6: bevy_ecs::system::commands::CommandQueue::apply
             at ./crates/bevy_ecs/src/system/commands.rs:24:13
   7: <bevy_ecs::system::commands::CommandQueue as bevy_ecs::system::system_param::SystemParamState>::apply
             at ./crates/bevy_ecs/src/system/system_param.rs:447:9
   8: <(P0,P1,P2,P3) as bevy_ecs::system::system_param::SystemParamState>::apply
             at ./crates/bevy_ecs/src/system/system_param.rs:977:19
   9: <bevy_ecs::system::into_system::FunctionSystem<In,Out,Param,Marker,F> as bevy_ecs::system::system::System>::apply_buffers
             at ./crates/bevy_ecs/src/system/into_system.rs:161:9
  10: <bevy_ecs::schedule::stage::SystemStage as bevy_ecs::schedule::stage::Stage>::run
             at ./crates/bevy_ecs/src/schedule/stage.rs:689:21
  11: bevy_ecs::schedule::Schedule::run_once
             at ./crates/bevy_ecs/src/schedule/mod.rs:201:13
  12: <bevy_ecs::schedule::Schedule as bevy_ecs::schedule::stage::Stage>::run
             at ./crates/bevy_ecs/src/schedule/mod.rs:219:21
  13: bevy_app::app::App::update
             at ./crates/bevy_app/src/app.rs:58:9
  14: bevy_winit::winit_runner_with::{{closure}}
             at ./crates/bevy_winit/src/lib.rs:485:17
  15: <alloc::boxed::Box<F,A> as core::ops::function::FnMut<Args>>::call_mut
             at /Users/robparrett/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1335:9
  16: <winit::platform_impl::platform::app_state::EventLoopHandler<T> as winit::platform_impl::platform::app_state::EventHandler>::handle_nonuser_event
             at /Users/robparrett/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/macos/app_state.rs:71:9
  17: winit::platform_impl::platform::app_state::Handler::handle_nonuser_event
             at /Users/robparrett/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/macos/app_state.rs:173:21
  18: winit::platform_impl::platform::app_state::AppState::cleared
             at /Users/robparrett/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/macos/app_state.rs:331:13
  19: winit::platform_impl::platform::observer::control_flow_end_handler
             at /Users/robparrett/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.24.0/src/platform_impl/macos/observer.rs:135:13
@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior C-Examples An addition or correction to our examples labels Mar 20, 2021
@alice-i-cecile alice-i-cecile added this to the Bevy 0.5 milestone Mar 20, 2021
@alice-i-cecile
Copy link
Member

As with the other two bugs; I think this is spooky enough to try and track down and fix before we launch.

@rparrett
Copy link
Contributor Author

I think this is probably due to a system ordering issue between spawn_bonus and move_player.

If the cake is spawned on top of the player, move_player immediately attempts to despawn_recursive an entity that hasn't actually been added yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug An unexpected or incorrect behavior C-Examples An addition or correction to our examples
Projects
None yet
2 participants