-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Merged by Bors] - Add missing docs to World::change_tick
and World::read_change_tick
#6765
Conversation
@@ -1390,11 +1390,19 @@ impl World { | |||
self.change_tick.fetch_add(1, Ordering::AcqRel) | |||
} | |||
|
|||
/// Reads the current change tick of this world. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super basic question so I'm sorry lol, but is a change tick different than a normal tick?
I understand a tick
to be a "loop" of the main update loop. But in ECS's I suppose it might not be that simple. I guess this tick is specific to the world?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose maybe I need some place to read up about how ticks
are done in ECS's since maybe worlds and systems run at different ticks? Is there a good place to read up on that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically, a change tick is a number signifying when a system ran in relation to other systems. This is used to answer questions like "did this value change since the last time this system ran?", powering change detection.
I don't know of any write-ups on change detection internals, so I'd recommend reading these source files for more details:
https://github.com/bevyengine/bevy/blob/main/crates/bevy_ecs/src/change_detection.rs
https://github.com/bevyengine/bevy/blob/main/crates/bevy_ecs/src/component.rs#L521
I suppose the docs are in need of a centralized explanation of how change ticks work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you so much!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This reverts commit 5a3dbca.
bors r+ |
#6765) # Objective The methods `World::change_tick` and `World::read_change_tick` lack documentation and have confusingly similar behavior. ## Solution Add documentation and clarify the distinction between the two functions.
World::change_tick
and World::read_change_tick
World::change_tick
and World::read_change_tick
bevyengine#6765) # Objective The methods `World::change_tick` and `World::read_change_tick` lack documentation and have confusingly similar behavior. ## Solution Add documentation and clarify the distinction between the two functions.
bevyengine#6765) # Objective The methods `World::change_tick` and `World::read_change_tick` lack documentation and have confusingly similar behavior. ## Solution Add documentation and clarify the distinction between the two functions.
bevyengine#6765) # Objective The methods `World::change_tick` and `World::read_change_tick` lack documentation and have confusingly similar behavior. ## Solution Add documentation and clarify the distinction between the two functions.
Objective
The methods
World::change_tick
andWorld::read_change_tick
lack documentation and have confusingly similar behavior.Solution
Add documentation and clarify the distinction between the two functions.