Skip to content

Commit

Permalink
fix: make sure input resources are always present.
Browse files Browse the repository at this point in the history
In fishfolk/jumpy#861 it appears that the
assets may have finished loading after the input system, but before the
update system, leading to the game being ticked without the keyboard
inputs.

This initializes all of the input resources to their defaults so that
the game will never be ticked without them.
  • Loading branch information
zicklag committed Oct 19, 2023
1 parent f84d07c commit ebd58e2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions framework_crates/bones_bevy_renderer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ impl BonesBevyRenderer {
.insert_shared_resource(bones::EguiTextures::default());
app.insert_resource(BonesImageIds::default());

// Insert empty inputs that will be updated by the `insert_bones_input` system later.
self.game.init_shared_resource::<bones::KeyboardInputs>();
self.game.init_shared_resource::<bones::MouseInputs>();
self.game.init_shared_resource::<bones::GamepadInputs>();

// Insert the bones data
app.insert_resource(BonesData {
asset_server: self
Expand Down

0 comments on commit ebd58e2

Please sign in to comment.