mirror of
https://github.com/bevyengine/bevy
synced 2025-01-13 21:54:51 +00:00
78335a5ddc
# Objective - Allow registering of systems from Commands with `Commands::register_one_shot_system` - Make registering of one shot systems more easy ## Solution - Add the Command `RegisterSystem` for Commands use. - Creation of SystemId based on lazy insertion of the System - Changed the privacy of the fields in SystemId so Commands can return the SystemId --- ## Changelog ### Added - Added command `RegisterSystem` - Added function `Commands::register_one_shot_system` - Added function `App::register_one_shot_system` ### Changed - Changed the privacy and the type of struct tuple to regular struct of SystemId ## Migration Guide - Changed SystemId fields from tuple struct to a normal struct If you want to access the entity field, you should use `SystemId::entity` instead of `SystemId::0` ## Showcase > Before, if you wanted to register a system with `Commands`, you would need to do: ```rust commands.add(|world: &mut World| { let id = world.register_system(your_system); // You would need to insert the SystemId inside an entity or similar }) ``` > Now, you can: ```rust let id = commands.register_one_shot_system(your_system); // Do what you want with the Id ``` --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: Pablo Reinhardt <pabloreinhardt@gmail.com> |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |