-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Open
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsA-UIGraphical user interfaces, styles, layouts, and widgetsGraphical user interfaces, styles, layouts, and widgetsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite challenging from either a design or technical perspective. Ask for help!S-BlockedThis cannot move forward until something else changesThis cannot move forward until something else changes
Description
Bevy version and features
- 0.18
- ["2d", "dynamic_linking", "bevy_dev_tools", "experimental_bevy_ui_widgets", "experimental_bevy_feathers"]
What you did
I tried to create a feathers checkbox and initialize it with a boolean variable. This is currently not possible
What went wrong
I tried to do something like this:
fn create_checkbox(checked: bool) -> impl Bundle {
checkbox(??? , Spawn(Text::new("Checkbox")))
}The checkbox state gets set based on the bundle provided to it. So I provide Checked to set it checked or () to set it not checked.
But what do I do if I want to set it checked based on the provided variable? Something like the following does not work:
fn create_checkbox(checked: bool) -> impl Bundle {
let bundle = if checked {
Checked
} else {
()
};
checkbox(bundle , Spawn(Text::new("Checkbox")))
}This does not compile, as the branches have different types.
I would expect that I could just initialize the checkbox like the Slider, where I put all the properties into a properties component (like SliderProps). The doc of the checkbox function even mentions a third parameter named props, which does not exist.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsA-UIGraphical user interfaces, styles, layouts, and widgetsGraphical user interfaces, styles, layouts, and widgetsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useD-ComplexQuite challenging from either a design or technical perspective. Ask for help!Quite challenging from either a design or technical perspective. Ask for help!S-BlockedThis cannot move forward until something else changesThis cannot move forward until something else changes