mirror of
https://github.com/bevyengine/bevy
synced 2024-11-24 13:43:04 +00:00
BRP System Ordering (#16198)
# Objective - Attempts to fix #16042 ## Solution - Added a new `RemoteSystem` `SystemSet` for the BRP systems. - Changed the schedule on which these systems run from `Update` to `Last`. ## Testing - I did not test these changes and would appreciate a hand in doing so. I assume it would be good to test that you can order against these systems easily now. --- ## Migration Guide - `process_remote_requests`, `process_ongoing_watching_requests` and `remove_closed_watching_requests` now run in the `Last` schedule. Make sure you use `RemoteSystem` `SystemSet` in case you need to order your systems against them.
This commit is contained in:
parent
a44b668b90
commit
7fc8318b7f
1 changed files with 12 additions and 3 deletions
|
@ -301,11 +301,11 @@
|
|||
//! [fully-qualified type name]: bevy_reflect::TypePath::type_path
|
||||
|
||||
use async_channel::{Receiver, Sender};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_app::{prelude::*, MainScheduleOrder};
|
||||
use bevy_derive::{Deref, DerefMut};
|
||||
use bevy_ecs::{
|
||||
entity::Entity,
|
||||
schedule::IntoSystemConfigs,
|
||||
schedule::{IntoSystemConfigs, ScheduleLabel},
|
||||
system::{Commands, In, IntoSystem, ResMut, Resource, System, SystemId},
|
||||
world::World,
|
||||
};
|
||||
|
@ -434,11 +434,16 @@ impl Plugin for RemotePlugin {
|
|||
);
|
||||
}
|
||||
|
||||
app.init_schedule(RemoteLast)
|
||||
.world_mut()
|
||||
.resource_mut::<MainScheduleOrder>()
|
||||
.insert_after(Last, RemoteLast);
|
||||
|
||||
app.insert_resource(remote_methods)
|
||||
.init_resource::<RemoteWatchingRequests>()
|
||||
.add_systems(PreStartup, setup_mailbox_channel)
|
||||
.add_systems(
|
||||
Update,
|
||||
RemoteLast,
|
||||
(
|
||||
process_remote_requests,
|
||||
process_ongoing_watching_requests,
|
||||
|
@ -449,6 +454,10 @@ impl Plugin for RemotePlugin {
|
|||
}
|
||||
}
|
||||
|
||||
/// Schedule that contains all systems to process Bevy Remote Protocol requests
|
||||
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
struct RemoteLast;
|
||||
|
||||
/// A type to hold the allowed types of systems to be used as method handlers.
|
||||
#[derive(Debug)]
|
||||
pub enum RemoteMethodHandler {
|
||||
|
|
Loading…
Reference in a new issue