Bevy Version:0.13(outdated!)

As this page is outdated, please refer to Bevy's official migration guides while reading, to cover the differences: 0.13 to 0.14.

I apologize for the inconvenience. I will update the page as soon as I find the time.


List All Resource Types

This example shows how to print a list of all types that have been added as resources.

fn print_resources(world: &World) {
    let components = world.components();

    let mut r: Vec<_> = world
        .storages()
        .resources
        .iter()
        .map(|(id, _)| components.get_info(id).unwrap())
        .map(|info| info.name())
        .collect();

    // sort list alphebetically
    r.sort();
    r.iter().for_each(|name| println!("{}", name));
}
// print main world resources
app.add_systems(Last, print_resources);

// print render world resources
app.sub_app_mut(RenderApp)
    .add_systems(Render, print_resources.in_set(RenderSet::Render));

It lists the types of all the resources that currently exist in your ECS World (by all registered plugins, your own, etc.).

Note that this does not give you a list of every type that is useful as a resource. For that, you should consult API documentation, looking for implementers of the Resource trait.

See here for a summary of types provided in Bevy.