@@ -97,7 +97,7 @@ impl Debug for App {
97
97
/// # Example
98
98
///
99
99
/// ```rust
100
- /// # use bevy_app::{App, AppLabel, SubApp};
100
+ /// # use bevy_app::{App, AppLabel, SubApp, CoreSchedule };
101
101
/// # use bevy_ecs::prelude::*;
102
102
/// # use bevy_ecs::scheduling::ScheduleLabel;
103
103
///
@@ -107,26 +107,28 @@ impl Debug for App {
107
107
/// #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, AppLabel)]
108
108
/// struct ExampleApp;
109
109
///
110
- /// #[derive(Debug, Hash, PartialEq, Eq, Clone, ScheduleLabel)]
111
- /// struct ExampleSchedule;
112
- ///
113
- /// let mut app = App::empty();
110
+ /// let mut app = App::new();
111
+ ///
114
112
/// // initialize the main app with a value of 0;
115
113
/// app.insert_resource(Val(10));
116
114
///
117
115
/// // create a app with a resource and a single schedule
118
116
/// let mut sub_app = App::empty();
117
+ /// // add an outer schedule that runs the main schedule
118
+ /// sub_app.add_simple_outer_schedule();
119
119
/// sub_app.insert_resource(Val(100));
120
- /// let mut example_schedule = Schedule::new();
121
- /// example_schedule.add_system(|counter: Res<Val>| {
120
+ ///
121
+ /// // initialize main schedule
122
+ /// sub_app.init_schedule(CoreSchedule::Main);
123
+ /// sub_app.add_system(|counter: Res<Val>| {
122
124
/// // since we assigned the value from the main world in extract
123
125
/// // we see that value instead of 100
124
126
/// assert_eq!(counter.0, 10);
125
127
/// });
126
- /// sub_app.add_schedule(ExampleSchedule, example_schedule);
127
- ///
128
+ ///
128
129
/// // add the sub_app to the app
129
130
/// app.insert_sub_app(ExampleApp, SubApp::new(sub_app, |main_world, sub_app| {
131
+ /// // extract the value from the main app to the sub app
130
132
/// sub_app.world.resource_mut::<Val>().0 = main_world.resource::<Val>().0;
131
133
/// }));
132
134
///
0 commit comments