Expand description
Easily spawn windows as independent UI roots. Ideal for debug widgets!
§Usage
app.add_plugins(WindowAsUiRootPlugin);
commands.spawn((
WindowAsUiRoot,
BackgroundColor(Color::WHITE),
children![(
Text::new("Hello World!"),
TextColor(Color::BLACK),
)],
));Insert the WindowAsUiRoot component on an entity and this plugin will:
- Insert
Node,Window, andCameracomponents if they don’t already exist. - Connect the camera to the root node and window.
- Automatically resize the window to match the root node’s layout size (if it is auto or fixed).
§Tips
- Use the
CloseWithrelation to automatically close nested windows. - Set
WindowPlugin.exit_conditiontoExitCondition::OnPrimaryClosedto prevent popups from outliving the main window. - Insert
Node { width: percent(100), height: percent(100), ..default() }on the UI root to make it resizable by the user.
Structs§
- Close
With - Add this relation from sub-windows to their parents to automatically close them.
- Window
AsUi Root - Use this component to spawn windows as independent UI roots.
- Window
AsUi Root Plugin - This plugin handles creating and resizing windows, add it to use this library.