Add documentation and examples of [ScheduleLabel] usage.#19329
Conversation
This documentation is intended to be useful to users of `bevy_ecs` not also using `App`. Fixes bevyengine#19270.
|
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
alice-i-cecile
left a comment
There was a problem hiding this comment.
Some minor wording nits but you've got the gist of this and it's nice to document this more fully.
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
theotherphil
left a comment
There was a problem hiding this comment.
Looks good to me! A couple of nits to address or not as you like. Do all of the new intra-doc links work correctly? (I'd check myself but am on mobile at the moment.)
| /// | ||
| /// // Declare a new schedule label. | ||
| /// #[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash, Default)] | ||
| /// struct Update; |
There was a problem hiding this comment.
Nit: might be a bit confusing that this is using the name of one of Bevy's default schedules.
There was a problem hiding this comment.
True. Can you think of a good new example system name? I couldn't, at the time. …maybe something like “Synchronize”.
There was a problem hiding this comment.
A lot of examples use deliberately meaningless names like MySchedule. Your suggestion also sounds fine to me.
|
|
||
| define_label!( | ||
| /// A strongly-typed class of labels used to identify a [`Schedule`](crate::schedule::Schedule). | ||
| /// A strongly-typed class of labels used to identify a [`Schedule`]. |
There was a problem hiding this comment.
Nit: I'm not sure what Bevy's approach is to example (near) duplication - might be better to just link?
There was a problem hiding this comment.
I think there is some value in allowing these examples to be visible without following a link, and potentially diverge in the future as the API is revised — in particular, this one focuses on defining a ScheduleLabel, and the other one focuses on a Schedule being in a World, hence the slightly different orderings. But I don't think there's a lot of value there.
Co-authored-by: theotherphil <phil.j.ellison@gmail.com>
Objective
Add documentation useful to users of
bevy_ecsnot also usingApp.Fixes #19270.
Solution
Scheduledocumentation.derive(ScheduleLabel)totrait ScheduleLabel.Schedulewhich demonstrates using a schedule via label instead of owning it directly.World::add_schedule(), andWorld::run_schedule().Testing
Reviewed generated documentation.
Please review this documentation carefully for correctness, as I have little experience with
bevy_ecsand I am adding this information because it would have helped my own past confusion, but I may still be wrong about how things should be done.