bevyengine / bevyengine/bevy

Document that chained `.run_if(a).run_if(b)` don't short-circuit, in contrast to `run_if(a.and(b))`

Open
#21,244 0 comments 1 reaction 0 assignees View on GitHub
A-ECS C-Docs D-Straightforward S-Ready-For-Implementation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## How can Bevy's documentation be improved?

Fun fact:

This panics
```rust
fn noop() {}
app.add_systems(Update, noop.run_if(|| false).run_if(|| panic!()));
```

this does not:
```rust
fn noop() {}
app.add_systems(Update, noop.run_if((|| false).and(|| panic!())));
```

Would you have guessed so? :D The docs should probably be on `run_if` and point users to `and`.

The reason for this is that the `run_if` calls need to update their ticks, so that things like `Changed` behave as expected. Does `and` have that problem? IDK
One person says "It looks like the return value of and is also a System, so it enters the ECS as a single system, with one set of ticks", the other "I think each sub system of and will store its own ticks, so the second system will have an old value if it gets skipped."

Contributor guide

Open the contributing guide

Research direction

Locate the existing documentation for `run_if` and `and`, then compare the two examples in the issue and investigate the stated system-tick behavior. Done means the `run_if` documentation explains that chained calls do not short-circuit like `run_if(a.and(b))`, points readers to `and`, and accurately addresses the tick caveat.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.