Files
bevy/examples/dev_tools/schedule_data.rs
andriyDev efc6464f9b Create types to store serializable data about the ECS schedule and provide tools for extracting this data. (#22520)
# Objective

- A step towards #10981.
- Allow us to extract data from an app about the schedules.

Here are also some **non-goals** for this PR. These are left as future
work:

- Extract every piece of data in the schedule. I've focused on a rough
set of information that should let us visualization the most important
parts.
- Provide utilities for interpreting the data. This PR is focused on
just extracting the data, interpreting it comes next.
- Any sort of dot graph tools.

## Solution

- Create ser/de compatible structs for representing schedule data.
- Create a function to get schedule data from an initialized `Schedule`.
- Create a plugin to automatically extract the schedule data for every
schedule in the `App`.
- Note this doesn't include other subapps, I'll also leave that to
another PR.
- Make `bevy_ecs` return edges that build passes added.
- Make `bevy_ecs` return the "build metadata" to the caller, and also
trigger as an event.

## Testing

- Added tests!
- Added an example - it outputs a ron file. I assume its all valid.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Kevin Chen <chen.kevin.f@gmail.com>
2026-04-06 23:06:15 +00:00

15 lines
549 B
Rust

//! This example demonstrates how to automatically serialize schedule data.
use bevy::{dev_tools::schedule_data::plugin::*, prelude::*};
fn main() {
App::new()
.add_plugins((DefaultPlugins, SerializeSchedulesPlugin::default()))
// This resource is only necessary to put the output in a nice spot for the example code.
// By default, this lands at "<working directory>/app_data.ron".
.insert_resource(SerializeSchedulesFilePath(
"examples/dev_tools/app_data.ron".into(),
))
.run();
}