Skip to content
Discussion options

You must be logged in to vote

Add a resource, then request it:

 App::new()
      .add_plugins(MinimalPlugins)
      .add_systems(Startup, setup)
      .add_resource(PathToLoad("..."))

fn setup(mut commands: Commands, path: Res<PathToLoad>) {...}

Alternatively, you can make a higher-order function, but that's pretty advanced:

 App::new()
      .add_plugins(MinimalPlugins)
      .add_systems(Startup, setup("path_to_load"))

fn setup(path: &str) -> impl SomeBlackMagic {
  return move |commands: &Commands| {
    todo!()
  }
}

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ThomasCartier
Comment options

@ThomasCartier
Comment options

@ThomasCartier
Comment options

Answer selected by ThomasCartier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants