Replies: 3 comments 2 replies
-
I don't understand what you mean by "ordering by data dependency". You seem to want to have just a way to order systems? Check out the following example: https://github.com/bevyengine/bevy/blob/v0.11.3/examples/ecs/ecs_guide.rs#L293-L315 You have two ways to order systems:
app.add_systems(Update, (first_system.before(second_system), second_system));
app.add_systems(Update, (first_system, second_system).chain()); Within a single app.add_systems(Update, (
(system1a, system1b, system1c),
system2a,
(system3a, system3b),
).chain()); Maybe you don't mean that? But I really don't understand what "Ordering by data dependency" means. Fundamentally, even if two systems access the same data (for example, a resource or component), you still need to specify an order. It's not enough to know that two systems access the same data, hence, it's not possible to "order by data dependency". But I don't think that's what you mean. |
Beta Was this translation helpful? Give feedback.
-
Hi, it might be completely unrelated but I struggled with #[derive(Default)]
pub struct MyStruct<T> {
marker: PhantomData<fn() -> T>
} And also I would start with the minimal solution so when you want to derive SystemSet and set bound T to Component #[derive(Default, SystemSet)]
pub struct DataLabel<T: Component> {
_phantom: PhantomData<fn() -> T>,
} I hope I've helped at least a bit ;) I'm quite curious what you want to achieve. |
Beta Was this translation helpful? Give feedback.
-
Well, I decided to implement traits by hand without derive macro. Then, now I found #8595 . Any way, thank you! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello.
I'm trying to determine system ordering by data dependencies. What I want is like this.
The system produce the subjects by the dependencies.
So I wrote the code below, to represent
SystemSet
which produces dataT
.But this doesn't compile, saying
T
needs to beClone
,Eq
,Send
, ... and so on.I found Rust issue which may relate (rust-lang/rust#26925), but not understand well.
Is there a way to make it compile?
Or, existing way to ordering system by data dependencies?
more explanation
For example, consider
system1
writeComponentA
andsystem2
readComponentA
.I say
system2
dependsComponentA
.In standard form, we can
system2.after(system1)
.But I want to write
system2.after(DataLabel<ComponentA>)
, whereDataLabel<ComponentA>
isSystemSet
which may write toComponentA
. I mean this for ordering system by data dependencies.In this form, we don't need to list all systems which may write to
ComponentA
. We can just think about thesystem2
.I'm trying to write function
add_data_dependencies
which add system toDataLabel<Subject>
and order them afterDataLabel<Dependency>
.Then the problem, I can't write
DataLabel<T>
, theSystemSet
withPhantomData<T>
.Beta Was this translation helpful? Give feedback.
All reactions