Conditional Commands
Implements three extension traits
ConditionalInsertComponentsExt
forEntityCommands
andEntityMut
with methods:insert_if
insert_if_else
insert_bundle_if
insert_bundle_if_else
ConditionalChildBuilderExt
forEntityCommands
with method:with_children_if
ConditionalWorldChildBuilderExt
forEntityMut
with method:with_children_if
that allow for conditional component, bundle, and child insertion without the need for an intermediate EntityCommands
or EntityMut
binding.
- Supports Bevy 0.7
New for Version 0.2
-
Implementated traits for
EntityMut
. -
*_if_else
methods.
Example
use *;
;
;
Usage
Add to your Cargo.toml [Dependencies]
section
conditional_commands = "0.2"
Then access with the use
declaration
use *;
Motivating Contrived ECS Fizz-Buzz Example
use *;
;
;
;
With Conditional Commands we no longer need the intermediate EntityCommands binding.
use *;