-
-
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
Simplify the ComponentIdFor
type
#8845
Conversation
@@ -1,9 +1,10 @@ | |||
//! Types for declaring and storing [`Component`]s. | |||
|
|||
use crate::{ | |||
self as bevy_ecs, |
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.
What this bein used for?
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.
Our derive macros don't know the difference between bevy_ecs
and a third party crate, so we need to include this anytime we use a derive from within bevy_ecs
. It's a very annoying issue that, as far as I know, can't be fixed without changes to rustc.
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.
Yeah I've run into this before and never found a satisfying workaround.
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.
Ah ya, forgot about that req, looks good to me :)
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.
Agreed: this is cleaner.
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.
Had no idea this even existed 😳
Objective
ComponentIdFor
is a type that gives you access to a component'sComponentId
in a system. It is currently awkward to use, since it must be wrapped in aLocal<>
to be used.Solution
Make
ComponentIdFor
a proper SystemParam.Changelog
ComponentIdFor
in order to simplify how it is used.Migration Guide
The type
ComponentIdFor<T>
now implementsSystemParam
instead ofFromWorld
-- this means it should be used as the parameter for a system directly instead of being used in aLocal
.