Skip to content

Commit

Permalink
Fix examples using MinimalPlugins
Browse files Browse the repository at this point in the history
  • Loading branch information
CosterM committed Dec 3, 2024
1 parent 01a0263 commit ce97d64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 7 additions & 2 deletions examples/items_by_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//!
//! This code is largely copied from the `simple.rs` example: we're just adding constants and a new system to demonstrate the name-based lookups.
use bevy::{log::LogPlugin, prelude::*, utils::HashMap};
use bevy::{log::LogPlugin, prelude::*, state::app::StatesPlugin, utils::HashMap};
use leafwing_manifest::{
asset_state::SimpleAssetState,
identifier::Id,
Expand Down Expand Up @@ -67,7 +67,12 @@ impl Manifest for ItemManifest {

fn main() {
App::new()
.add_plugins((MinimalPlugins, AssetPlugin::default(), LogPlugin::default()))
.add_plugins((
MinimalPlugins,
AssetPlugin::default(),
LogPlugin::default(),
StatesPlugin,
))
.init_state::<SimpleAssetState>()
.add_plugins(ManifestPlugin::<SimpleAssetState>::default())
.register_manifest::<ItemManifest>("items.ron")
Expand Down
6 changes: 3 additions & 3 deletions examples/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! See the other examples for more advanced use cases!
//! The `raw_manifest.rs` example is a good next step that builds upon this example.
use bevy::{app::AppExit, log::LogPlugin, prelude::*, utils::HashMap};
use bevy::{app::AppExit, log::LogPlugin, prelude::*, state::app::StatesPlugin, utils::HashMap};
use leafwing_manifest::{
asset_state::SimpleAssetState,
identifier::Id,
Expand Down Expand Up @@ -69,9 +69,9 @@ impl Manifest for ItemManifest {

fn main() {
App::new()
// leafwing_manifest requires `AssetPlugin` to function
// leafwing_manifest requires `AssetPlugin`, and `StatesPlugin` to function
// This is included in `DefaultPlugins`, but this example is very small, so it only uses the `MinimalPlugins`
.add_plugins((MinimalPlugins, AssetPlugin::default(), LogPlugin::default()))
.add_plugins((MinimalPlugins, AssetPlugin::default(), LogPlugin::default(), StatesPlugin))
// This is our simple state, used to navigate the asset loading process.
.init_state::<SimpleAssetState>()
// Coordinates asset loading and state transitions.
Expand Down

0 comments on commit ce97d64

Please sign in to comment.