bevy
bevy copied to clipboard
UI Style reuse: composition + assets
What problem does this solve or what need does it fill?
At the moment Style
is incredibly verbose to use, just have a look at the UI example.
In order to improve ergonomics and reduce boilerplate when dealing with UI we need to do something about it and we should strive to achieve the level of UX that we see in other parts of the engine.
What solution would you like?
In order to do so we are going to need two related but IMO orthogonal features:
- Style composition: bevyengine/rfcs#1
- Style as assets
I don't know exactly what these would look like in implementation, but I'm hoping some of you have good ideas for design-approaches that we then split out into separate issues or PRs.
This issue should be about figuring out a scope and requirements for both of these features
What alternative(s) have you considered?
- Leave style as is and keep verbose + cumbersome UX
- Style inheritance
- Others?
Additional context
We might find that we are blocked on other features like scenes or reflection on some of this but in that case it is good to know exactly where the blocker is so that we can push to unblock those 😄
Style inheritance is going to be extremely controversial FYI. Personally, I'm hopeful for a compositional design, as laid out in https://github.com/bevyengine/rfcs/pull/1
Style inheritance is going to be extremely controversial FYI. Personally, I'm hopeful for a compositional design, as laid out in bevyengine/rfcs#1
Good point, I've updated the issue to better reflect weighing the problem in this direction
I think inheritance would be fine and not too controversial if it was opt in
Hello, I'm trying to experiment with reusable building blocks for UI, and while being relatively unfamiliar with Bevy I found this a little bit not clear: how to write reusable functions that allow for spawning bundles both as a standalone entity and as a child of another entity? Look at my code sample:
the only difference between these
create_button
functions is Commands
and ChildBuilder
types, everything else is the same, then I thought maybe there is an API that allow for using both Commands
and ChildBuilder
? Maybe it may improve Bevy? @alice-i-cecile what do you think?
the code that uses these functions is not particularly interesting, but I believe that we can do much better than this if we think a little bit of how to improve that API