-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Increase type safety and clarity for change detection #7905
Conversation
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.
Rename and refactor appears to be done correctly. I'm strongly in favoring of improving type safety here.
I have some suggestions for how we can further improve encapsulation here now, but they're non-blocking.
I've encapsulated the field on |
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.
Thanks for doing this! I like the new names. I recall looking over this stuff earlier and being fairly confused so much appreciated.
I have no idea why CI is failing now. |
CI failure looks like #8002. |
# Objective While migrating the engine to use the `Tick` type in #7905, I forgot to update `UnsafeWorldCell::increment_change_tick`. ## Solution Update the function. --- ## Changelog - The function `UnsafeWorldCell::increment_change_tick` is now strongly-typed, returning a value of type `Tick` instead of a raw `u32`. ## Migration Guide The function `UnsafeWorldCell::increment_change_tick` is now strongly-typed, returning a value of type `Tick` instead of a raw `u32`.
Objective
Tick
for dealing with change ticks, but most of the engine still just usesu32
.last_change_tick
andchange_tick
often appear together, however the meaning of these names is unclear.Solution
Tick
type throughout the engine.last_change_tick
andchange_tick
tolast_run
andthis_run
, respectively.Changelog
Tick
instead ofu32
.Migration Guide
The engine now uses the type
Tick
for dealing with change ticks, instead ofu32
. Any code that interfaced with engine internals will need to be updated, including:SystemParam
,WorldQuery
,DetectChanges
, andDetectChangesMut
.World::change_tick
andread_change_tick
.System::set_last_change_tick
andget_last_change_tick
. Also, these methods have been renamed toset_last_run
andget_last_run
, respectively.SystemChangeTick::change_tick
andlast_change_tick
. These methods have been renamed tothis_run
andlast_run
, respectively.Tick::set_changed
, which has been renamed to justset
.