-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Implements conversion from SystemId to Entity
#11759
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
Implements conversion from SystemId to Entity
#11759
Conversation
…upposed to be an opaque type, it's still useful to label the entity with either custom components or with debug components such as Name.
|
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
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'm a little nervous about doing this, as we may end up breaking this functionality in the future. But I can see the value in your use case.
What if we inserted the Name component to all system entities that matched the system name instead?
Basically, insert the name of the given system on the entity? |
|
Thanks for getting back to me so quick!
Adding the Right now, I am using about a dozen registered systems (to modularize dialog logic), so automatically naming them is sufficient. However, inserting more and more registered systems would eventually warrant a root entity under which I hide all those systems. My plan was to In any case, if your intuition says it will be refactored in the future, feel free to close the PR, it's a nice-to-have. |
|
IMO, would be good to support some kind of API to help the user, even if this will be refactored in the future we would first spawn the entity with a given bundle (the user would give the bundle to the function) |
|
Hmm right, it's stuck over in bevy_core. Even though this is likely to get refactored, I think this is a reasonable direction. @maniwani is hoping to make all systems entities one day, so this would still be effectively possible. |
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 think we should improve these docs, but I'm on board.
Accepted @alice-i-cecile docs suggestion Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
SystemId to Entity
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 think this is OK to allow since the component holding the system trait object is still private.
That said, having visible components will make system entities easier to match in queries, so it'll be easier for someone to delete them by accident, so I guess just watch out for that.
# Objective Right now when using egui, systems are inserted without any identifier and to the root. I'd like to name those systems and insert them as children to a root entity. This helps to keep the editor organized. ## Solution - Although the `SystemId` is documented as an opaque type, examples depicted above benefit from tear down of the abstraction. --- ## Changelog ### Added - Implemented `From<SystemId>` for `Entity` --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
# Objective Right now when using egui, systems are inserted without any identifier and to the root. I'd like to name those systems and insert them as children to a root entity. This helps to keep the editor organized. ## Solution - Although the `SystemId` is documented as an opaque type, examples depicted above benefit from tear down of the abstraction. --- ## Changelog ### Added - Implemented `From<SystemId>` for `Entity` --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Objective
Right now when using egui, systems are inserted without any identifier and to the root. I'd like to name those systems and insert them as children to a root entity. This helps to keep the editor organized.
Solution
SystemIdis documented as an opaque type, examples depicted above benefit from tear down of the abstraction.Changelog
Added
From<SystemId>forEntity